[CMake] file(TO_NATIVE_PATH ... ) and cross-compiling
Miroslav Keš
miroslav.kes at gmail.com
Tue Mar 20 11:21:49 EDT 2018
Hi!
I have question concerning the file(TO_NATIVE_PATH ...) behavior. The documentation says:
"The TO_NATIVE_PATH mode converts a cmake-style <path> into a native path with platform-specific slashes (\ on Windows and / elsewhere)."
... but it doesn't say if the decision is made based on the CMAKE_SYSTEM_NAME or the CMAKE_HOST_SYSTEM_NAME.
I have a project that builds the code for multiple platforms. The conversion works OK when building for Linux on Linux host or when building for Windows on a Windows host.
But if I cross-compile on a Windows for a non-Windows platform, the file(TO_NATIVE_PATH ...) converts paths to the target "non Windows" platform convention.
Is this the expected behavior?
I was going to use it when calling external programs on the build host (e.g. to generate Doxygen config file from a template using configure_file() ).
But it doesn't work because of the target host path convention output.
Thanks.
Mira
More information about the CMake
mailing list