Cross-platform paths in CMake
问题 I have a project I can build on both Linux and Windows using CMake. The only issue is that Unix-style paths, in CMakeLists.txt, can't work on Windows (which uses backslashes instead of slashes, also requiring the drive letter). Is there any way I can write a cross-platform CMakeLists.txt? 回答1: You question affects different details: Just don't use backslashes. Windows will also process slashes. Don't use drive letters. Use relative paths everywhere. GET_FILENAME_COMPONENT(X "${CMAKE_CURRENT