How to point cmake at specific directory for library?
2017-05-01 14:10
453 查看
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_PATHvariable upon configuring your build. In your project directory generate a
test_builddirectory and run:
mkdir test_buildcd test_buildcmake -DCMAKE_PREFIX_PATH=/home/me/src/opencv/install ..Setting the
CMAKE_PREFIX_PATHvariable will make the
find_package(OpenCV REQUIRED)command pick your OpenCV installation in
/home/me/src/opencvand set the
OpenCV_LIBSand
OpenCV_INCLUDE_DIRvariables accordingly.Alternatively you can edit a
CMakeCache.txtfile of an existing build directory with the CMake GUI editor and add the
CMAKE_PREFIX_PATHdefinition there. You have to re-configure your project then.
| howdo you list more than one directory on the cmake_prefix_path? – AndrewHundt Jul22 '15 at 16:58 | ||
| @AndrewHundtset it to a CMake list, i.e. cmake-D "CMAKE_PREFIX_PATH=/a/b/;/c/d"– sakra Jul22 '15 at 17:05 |
相关文章推荐
- How to create a custom directory for app files inside the ~/Library/Application Support directory.
- git tip: How to undo an uncommitted change/deletion for a specific file in your working directory
- How to set Item Level Permission for SharePoint 2007 (MOSS/WSS) List/Document Library Programmatically
- How to tell RNA-seq library type of strand-specific for RNA-seq data (for reads mapping by Tophat)
- How to Cheat at Designing a Windows Server 2003 Active Directory Infrastructure
- How to use document library in Sharepoint 2010
- Step By Step Guide to configure the “Replicating directory changes” for SharePoint 2010 and 2013
- How to disable directory listing for Jetty's We...
- How to Cheat at Designing Security for a Windows Server 2003 Network
- How to Stand Out at Work: 10 Tips for Programmers
- [转]如何删除放置库(How to Delete the Drop Off Library)in SharePoint 2010
- How to compile the IJG JPEG library (libjpeg) for Visual Studio 2010
- How to tune SharePoint 2010 Server for better performance?
- How to Model and Implement a Domain Specific Language (DSL) for Functional Test Automation
- How to set value for webpart’s properties when I create a new sharepoint template
- How to Modify the Password for SYSMAN and other Enterprise Manager Users at the OMS Level and Reposi
- How do I add a directory to my include path (@INC) at runtime?
- How to Install CURL library for PHP in Ubuntu box
- How to Change .NET Configuration Files at Runtime (including for WCF)
- How to add boot option manually for specific EFI file boot