$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/mylib> $<INSTALL_INTERFACE:include/mylib> # <prefix>/include/mylib ) 创建可重定位包 请注意,不建议使用依赖项包含目录的绝对路径填充目标的INSTALL_INTERFACE或INTERFACE_INCLUDE_DIRECTORIES。这会将依赖项的包含目录路径硬编码到已安装的包中,这些路径...
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/contrib> ) if(BUILD_MOCK) target_link_libraries(mock PRIVATE dlpack) endif() # Installation (https://github.com/forexample/package-example) { # Introduce variables: 0 comments on commit 3...
项目leveldb 和 basiccache, basiccache依赖 leveldb,下载都是在主项目中, 设置INTERFACE_INCLUDE_DIRECTORIES后, 在basiccache中都不需要find_package了 set( leveldb_INCLUDE_DIR"${CMAKE_CURRENT_SOURCE_DIR}/include")set( leveldb_INCLUDE_DIRS"${CMAKE_CURRENT_SOURCE_DIR}/include")ADD_LIBRARY(leveldb STA...
$<INSTALL_INTERFACE:include>) target_link_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib> $<INSTALL_INTERFACE:lib>) # Install libraries install(TARGETS ${PROJECT_NAME} DESTINATION lib/) @@ -365,6 +381,14 @@ elseif(PLATFORM_Rdkultra) rclcpp ) target...
好消息是在最新的cmake 3.11版本中,这个问题被正式解决了,参见CMake 3.11 Release Notes 就是说在3.11后续的版本中target_*系列command可以对imported target设置INTERFACE_*系列属性了。target_include_directories(MyLib INTERFACE mylib/include)这样的写法就不会报错了。
这些 Make 工具遵循着不同的规范和标准,所执行的 Makefile 格式也千差万别。这样就带来了一个严峻的...
target_include_directories(lib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> PRIVATE src) 我正在构建一个库项目,由于我使用标准路径( lib/用于静态库, include/用于公共标头),我希望通过设置 CMAKE_INSTALL_PREFIX并使用简单的 来摆脱困境install() 打电话,如...
- $<INSTALL_INTERFACE:include_5>- "$<BUILD_INTERFACE:${${PROJECT_NAME}_PUBLIC_INCLUDE_DIR}_6" >+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include_5>"+ "$<BUILD_INTERFACE:${${PROJECT_NAME}_PUBLIC_INCLUDE_DIR}_6>" Note that I also added$<INSTALL_PREFIX>/to theINSTALL_INTERFACEgenex ...
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/include/rapidjson/include) 目标的第一个参数必须是可执行文件的名称,因此在本例中是 SpyCBlock 第二个问题是目标的定义在目标的声明之前, target_include_directories(SpyCBlock ...)是在 add_executable($...
BUILD_INTERFACE和INSTALL_INTERFACE生成器表达式可用于根据使用位置描述单独的使用要求。INSTALL_INTERFACE...