更新时间:2022-04-11 22:52:56
包含CMakeLists.txt是运行时的当前目录。相反,每当需要相对于CMakeLists.txt的路径时,使用 $ {CMAKE_CURRENT_SOURCE_DIR}
。例如:
Don't assume that the directory containing CMakeLists.txt is the current directory at runtime. Instead, use ${CMAKE_CURRENT_SOURCE_DIR}
whenever you want a path relative to the CMakeLists.txt. For example:
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/hdr)