How to point cmake at specific directory for library?
来源:互联网 发布:linux 拷贝文件 编辑:程序博客网 时间:2024/06/03 09:39
I have a CMake project where I am using a library and now I want to test my code with a different version of that library. I can set INCLUDE_DIRECTORIES (and possibly later also linking) in the below example. But because I only want to do this temporarily, I'd like to manually set this path with ccmake/cmake-gui.
How do I do this?
project(min_example)cmake_minimum_required(VERSION 2.8)find_package(OpenCV REQUIRED)# Without the following line please:INCLUDE_DIRECTORIES("/home/me/src/opencv/install/include")add_executable(min_example main.cpp)
target_link_libraries(min_example ${OpenCV_LIBS})
This should be possible by setting the
CMAKE_PREFIX_PATH
variable upon configuring your build. In your project directory generate atest_build
directory and run:mkdir test_buildcd test_buildcmake -DCMAKE_PREFIX_PATH=/home/me/src/opencv/install ..
Setting the
CMAKE_PREFIX_PATH
variable will make thefind_package(OpenCV REQUIRED)
command pick your OpenCV installation in/home/me/src/opencv
and set theOpenCV_LIBS
andOpenCV_INCLUDE_DIR
variables accordingly.Alternatively you can edit a
CMakeCache.txt
file of an existing build directory with the CMake GUI editor and add theCMAKE_PREFIX_PATH
definition there. You have to re-configure your project then.1
how do you list more than one directory on the cmake_prefix_path? – Andrew Hundt Jul 22 '15 at 16:586@AndrewHundt set it to a CMake list, i.e.cmake -D "CMAKE_PREFIX_PATH=/a/b/;/c/d"
– sakra Jul 22 '15 at 17:05
- How to point cmake at specific directory for library?
- how to cmake to build directory
- How to use 'cp' command to exclude a specific directory?
- How to create a custom directory for app files inside the ~/Library/Application Support directory.
- How to tell RNA-seq library type of strand-specific for RNA-seq data (for reads mapping by Tophat)
- git tip: How to undo an uncommitted change/deletion for a specific file in your working directory
- How to search for STUFF at google
- How to Configure Javadoc for Robotium Library
- How to Insert Word Image at Specific Location with C#, VB.NET
- How to design your own extension-point for Eclipse
- PCL( I currently use CDT with cmake to build a Point Cloud Library (PCL) project.)
- Redirect Git Repo to Specific Directory
- how to set value for cmake arguement in command
- How to cmake
- how to install cmake
- how to use cmake
- How to add a new "CustomAction" in ECB for a specific list
- How to Model and Implement a Domain Specific Language (DSL) for Functional Test Automation
- 陈纪修老师《数学分析》 第03章:函数极限与连续函数 笔记
- 快速幂相关(template)
- Unity基础.004数学基础类:Time、Random以及Mathf
- solr搭建以及在Java中的使用【步骤】
- numpy中shape为(m,)的是行向量
- How to point cmake at specific directory for library?
- vue动画transition
- Ubuntu 挂载硬盘所用命令介绍
- 剑指offer——链表中倒数第k个结点
- 更新PIL库后遇到NotImplementedError: tostring() has been removed. Please call tobytes() instead
- 【京东商城首页实战2】导航条制作(1)
- 轻松学会ES6新特性之生成器
- 位运算的优势
- js 获取select的值 / js动态给select赋值