Details
Diff Detail
Event Timeline
For some reason CMAKE_EXECUTABLE_SUFFIX is not actually set by cmake at this point, requiring a -DCMAKE_EXECUTABLE_SUFFIX=.exe flag. Perhaps we need to manually detect if the platform is Windows and set it?
I think we need to do the same in test/make/Makefile.rules for AR and OBJCOPY.
I'm curious why it's not getting set automatically, as far as I can tell it should be. It seems to be defined in the cmake source at Modules/Platform/Windows.cmake
Can we look into why it's not set automatically? If you litter some
messages around the cmake code that sets it, you should be able to figure
it out
This is probably why:
http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_TOOLCHAIN_FILE.html
a file which is read early in the CMake run
I guess we could just use the same fix as this: rL126219
I'm a little confused about why you're setting EXECUTABLE_SUFFIX in Android.cmake but checking CMAKE_EXECUTABLE_SUFFIX in Makefile.rules, shouldn't those both be CMAKE_EXECUTABLE_SUFFIX?
test/make/Makefile.rules | ||
---|---|---|
88 ↗ | (On Diff #24321) | Add $(CMAKE_EXECUTABLE_SUFFIX) here too. I believe libtool would need to be used if running the test suite from Windows against a remote mac target, just as we need to use ar for linking when targetting linux from mac. |
Nevermind, I've looked up many examples to the contrary. I'm still not sure though if CMAKE_EXECUTABLE_SUFFIX will pick up the EXECUTABLE_SUFFIX or if the examples are just using a separate variable because CMAKE_EXECUTABLE_SUFFIX is not supposed to be settable. Maybe we need to set EXECUTABLE_SUFFIX in Makefile.rules and use that, i.e. in Makefile.rules:
EXECUTABLE_SUFFIX ?= $(CMAKE_EXECUTABLE_SUFFIX)
then use $(EXECUTABLE_SUFFIX)
I think the reason CMAKE_EXECUTABLE_SUFFIX isn't being set is because Android.cmake is being run as a CMAKE_TOOLCHAIN_FILE.
Ugh, Makefile.rules is for Makefile rules not CMake rules so CMAKE_EXECUTABLE_SUFFIX makes no sense at all. Do you have Windows -> {Linux, OS X} tests running yet?
test/make/Makefile.rules | ||
---|---|---|
88 ↗ | (On Diff #24321) | These look like rules for a mac host instead of a mac target, since xcrun looks like an XCode command. |
I think we need to do the same in test/make/Makefile.rules for AR and OBJCOPY.
Actually, I don't that'd be necessary. You can invoke executables on Windows without the extension, it's just that CMake actually checks if the executable exists. I originally made this CL because I wanted to cross compile the Android lldb-server on Windows (not terribly important, but sort of annoying if you have to switch to Linux while working on Windows -> Android). But there are other problems after this one, (e.g., Ninja generates response files with backslashes, but the ld.exe in the Android toolchain wants forward slashes). It's starting to look like more effort than it's worth.