cmake找到这些子目录后,会开始依次找<package>Config.cmake。 当我们使用find_package命令报错找不到路径时,手动添加路径即可: Module 模式:添加路径到CMAKE_MODULE_PATH变量(与include()命令共同使用这些路径) Config 模式:添加路径到Abc_DIR变量(直接设置为环境变量也可以) 例如找到 QT 库所需要的配置文件,如果 Q...
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") 更加完备的命令格式为: install(DIRECTORY dirs... TYPE <type> | DESTINATION <dir> [FILES_MATCHING] [[PATTERN <pattern> | REGEX <regex>] [EXCLUDE] [PERMISSIONS permissions...]] TYPE/DESTINATION 安装...
1 编译库 指定安装位置 sudo make -j8 sudo make install 看到安装好的库和头文件 2引用的时候 1 2 3 4 # 添加指定安装位置 set(Pangolin_DIR /home/r9000k/v2_project/v3_SLAM/激光雷达slam/Pangolin/install) find_package(Pangolin REQUIRED) include_directories(${Pangolin_INCLUDE_DIRS})...
@PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") # find_dependency(OtherLib REQUIRED) check_required_components("@PROJECT_NAME@") 文件放在跟install script的CMakeList.txt同级目录下 如何集成到项目中 find_package(xxx 1.0.0 CONFIG REQUIRED) target_link_libraries(ma...
cmake 生成供find_package使用的自定义模块; Creating Packages¶; How to use CMake to find and link to a library using install-export and find_package?; 二、我生成的项目 项目地址:BluffeyTest/Ransac; 文件结构如下: . ├── bin │ ├── testRansac ...
install( TARGETS cxx17 cxx17_test RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin COMPONENT runtime ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib COMPONENT lib ) 1. 2. 3. 4. 5. 这里编译生成了可执行文件和静态库,可以通过指定COMPOENNT只安装需要的lib,RUNTIME没有安装。
"install(", "\tFILES \\${CMAKE_CURRENT_BINARY_DIR\\}/\\${PROJECT_EXPORT_NAME\\}Targets.cmake", "\tDESTINATION \\${PROJECT_INSTALL_CMAKEDIR\\}", ")", "", "# install xxxConfigVersion.cmake", "include(CMakePackageConfigHelpers)", "write_basic_package_version_file(", "\t\\${...
find_package(OpenCV REQUIRED) set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) aux_source_directory(. ALL_SRCS) # 添加当前目录下所有的源文件 add_subdirectory(src) # 添加math子目录 ...
让CMake找到我的头文件, include_directories(/home/include)。常见的也有这样写,把工程的include文件夹加到包含路径。 代码语言:javascript 复制 include_directories(${CMAKE_CURRENT_LIST_DIR}/include), CMAKE_CURRENT_LIST_DIR这个变量,它表示当前CMakeLists所在的路径.或者PROJECT_SOURCE_DIR,这个命令的原型是 ...
这些 Make 工具遵循着不同的规范和标准,所执行的 Makefile 格式也千差万别。这样就带来了一个严峻的...