-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply *_FOR_BUILD flags to the native build if defined #1488
Conversation
If no value is given, CMake will unset the variables just as before.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frankly, I still don't think it's worth to incorporate such a change. Also, it doesn't work. Given the way the gentables project is currently called, no value will ever be given for any of the *_FOR_BUILD
vars. So this would just always behave as complicated unset()
.
It is a user (e.g. the Debian distribution) that sets And then you figured that this change does not regress anything and works as before (except when Debian uses it). Isn't that good enough then? |
I got that, yes. But still, I don't see how this can work via ExternalProject. Have you ever tested this? If so, pls. show me how you "set" those variables so that they're actually propagated to the gentables project. |
They are environment variables, not CMake variables. |
But they both compile fine. Why? Because you proposed a change, that doesn't work and that has presumably never been tested. Pls. come back with a proposal that actually works. PS: I would accept one that matches up more closely with the current approach to specify a host compiler. |
You are right, sorry. I misquoted the variables to read them from the environment. With the following patch it will work if the environment variables are set during the build (i.e. ninja or make) phase, not the configure (i.e. CMake) phase. However, I understand if you don't want to hear about this topic anymore. Sorry for wasting your time. :/ --- a/src/gentables/CMakeLists.txt
+++ b/src/gentables/CMakeLists.txt
@@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.5)
# remove $CC from the current environment and by that force cmake to look for a (working) C compiler,
# which hopefully will be the host compiler
-unset(ENV{CC})
+set(ENV{CC} $ENV{CC_FOR_BUILD})
# also unset $CFLAGS to avoid passing any cross compilation flags to the host compiler
-unset(ENV{CFLAGS})
+set(ENV{CFLAGS} $ENV{CFLAGS_FOR_BUILD} $ENV{CPPFLAGS_FOR_BUILD})
# linker flags as well
-unset(ENV{LDFLAGS})
+set(ENV{LDFLAGS} $ENV{LDFLAGS_FOR_BUILD})
project (gentables C)
|
If no value is given, CMake will unset the variables just as before.