考虑以下FindXXX.cmake
的示例:
find_path(XXX_INCLUDE_DIR NAMES XXX/XXX.h)
find_path(XXXYYY_INCLUDE_DIR NAMES YYY.h)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XXX DEFAULT_MSG
XXX_INCLUDE_DIR XXXYYY_INCLUDE_DIR)
set(XXX_INCLUDE_DIRS "${XXX_INCLUDE_DIR} ${XXXYYY_INCLUDE_DIR}")
就像在这个例子中一样,XXX_INCLUDE_DIRS
是一个中间有空格的字符串,因此,当使用<{p>}添加CMakeLists.txt
时
target_include_directories(a PRIVATE ${XXX_INCLUDE_DIRS})
编译器将其调用为
-I"XXXpath XXXYYYpath"
我应该如何修改
set(XXX_INCLUDE_DIRS ${XXX_INCLUDE_DIR} ${XXXYYY_INCLUDE_DIR})
设置变量XXX_INCLUDE_DIRS
的值?
XXX_LIBRARIES
中的多个库路径也出现了同样的问题。
答案 0 :(得分:2)
您为XXX_LIBRARIES
和XXX_INCLUDE_DIRS
等变量提供了多个条目,作为以分号分隔的列表。
set(XXX_INCLUDE_DIRS "${XXX_INCLUDE_DIR};${XXXYYY_INCLUDE_DIR}")