file(TO_NATIVE_PATH ... ) and cross-compiling

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

file(TO_NATIVE_PATH ... ) and cross-compiling

Miroslav Keš

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.



Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: