The evil CMake -- File system, path notation, slash

来源:互联网 发布:mac au cs6中文版下载 编辑:程序博客网 时间:2024/05/14 05:50
CMake file system use the front-slash '/' as the path seperator, but under Windows systems, this can cause problems(we all know that Windows use the back-slash '\' as the path seperator), especially in command line.

CMake has provided us the command FILE(TO_NATIVE_PATH) to convert CMake path into the native system path, and FILE(TO_CMAKE_PATH), vice versa. The example is:

# Convert CMake path into native pathFILE(TO_NATIVE_PATH ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} NATIVE_OUTPUT_PATH)MESSAGE(STATUS "This is the native output path=" ${NATIVE_OUTPUT_PATH})