Disclaimer: I cannot speak to intent, and have never used these before.
So since you’re cross compiling, when looking at the docs (
https://cmake.org/cmake/help/v3.0/command/file.html
<https://cmake.org/cmake/help/v3.0/command/file.html> ), I think you can get
away with using TO_CMAKE_PATH. I do not know how you actually determine this,
but the idea would be
if (CMAKE_CROSSCOMPILING)
if (… host is windows …)
if (… target is unix …)
… use TO_CMAKE_PATH …
else()
… use TO_NATIVE_PATH …
endif()
else() # … host is unix …
if (… target is unix …)
… use TO_CMAKE_PATH or TO_NATIVE_PATH …
else() # … target is windows
… PROBLEM …
endif()
endif()
That is, I think if you are compiling on Windows for Unix, you can cheat and
use TO_CMAKE_PATH to get unix style paths. But if you are compiling on unix
for Windows, I don’t know how you get it to be Windows paths.
But if this does solve Windows -> Unix, you could maybe just
message(FATAL_ERROR …) saying that cross compiling for Windows from Unix is not
supported. You could also take a look at the implementation of TO_NATIVE_PATH
and just snag the Windows code and make your own function that converts it,
maybe calling it to_windows_path() or something?
I hope that is helpful, but I really don’t know if anything in the above is
possible :/
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake