target_include_directories(<target> PRIVATE <include-search-dir>...) # 预处理的宏定义 target_compile_definitions(<target> PRIVATE <macro-definitions>...) # 编译选项 target_compile_options(<target> PRIVATE <compile-option>...) # 链接相关的库 target_link_libraries(<target> PRIVATE <dependency>...
target_sources(${PROJECT_NAME} # 往可执行文件中添加源文件 PRIVATE cloud_viewer.cpp ) find_package(PCL REQUIRED) # 寻找名字为PCL的库 直到找到为止 再继续进行下一步 #include 为指定目标(target)添加搜索路径 target_include_directories(${PROJECT_NAME} PUBLIC ${PCL_INCLUDE_DIRS} ) #link 声明了链接...
PUBLIC 和 INTERFACE 具有依赖传递性,而 PRIVATE 没有。 target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include) target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/impl) 六、target_link_libraries 如果target 是一个 library,该命令可以用来指定依赖本仓库的 ...
project(xxx)#必须add_subdirectory(子文件夹名称)#父目录必须,子目录不必add_library(库文件名称STATIC文件)#通常子目录(二选一)add_executable(可执行文件名称 文件)#通常父目录(二选一)include_directories(路径)#必须link_directories(路径)#必须target_link_libraries(库文件名称/可执行文件名称 链接的库文件名称)...
include_directories(scr/main/cpp/include/ ) #4.添加链接 target_link_libraries( jniutils goodutil ${log-lib} ) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 按照CMakeLists.txt 配置的头文件路径添加三方库的头文件(就是第一步的时候生成的头文件) ...
target_link_options(my_project PRIVATE /DEF:${CMAKE_CURRENT_SOURCE_DIR}/projects/my_project.def) endif () 接下来是添加头文件路径,使用 include_directories 或者 target_include_directories,target_include_directories 是比较现代的做法,官方是推荐使用后者的 ...
link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS})add_executable (pcd_write pcd_write.cpp) target_link_libraries (pcd_write ${PCL_LIBRARIES}) 1. 2. 3. 4. 5. 6. 7. 解释: 定义最小版,这是强制性的cmake,因为正在做一个非常基本的项目,不需要从cmake 2.8或更高的功...
target_link_libraries(main${LINK_LIBRARIES}) 使用OpenCV库CMakeLists文件模板 cmake_minimum_required(VERSION 2.8.12) project(OpenCV_test) #find packages find_package(OpenCV REQUIRED) #include headers include_directories(${OpenCV_INCLUDE_DIRS}) ...
当您将其传递给target_link_libraries时,您untitled2目标将继承这些include目录和库。最后,GLM是一个...
3.15,target_link_libraries 3.16,link_directories 3.17,add_subdirectory 3.18,intall 安装文件 ...