[CMake] cmake system library

Eric Noulard eric.noulard at gmail.com
Sat Jan 12 07:58:50 EST 2013


2013/1/12 Rolf Eike Beer <eike at sf-mail.de>:
> peterle oberwi wrote:
>> Hi,
>>
>> I want to use Boost library in my project. But there is one version
>> installed in the system, but not the version I want to use in my project.
>> Therefore I build the version and installed to a directory in my home. When
>> I want to use this version it's very anyoing, because cmake find the system
>> version. My solution is to give a path to the find_package command and use
>> my own modifed cmake module to use my version. Is there an easier solution
>> to use non-system libraries without modifying the cmake module or to set
>> specific variables e.g. there are libraries like qt which have no variables
>> which can be set.

I think you can set QTDIR in order to give a hint to find_package(Qt[3|4] ...)


>
> Set BOOST_ROOT to the root of your installing. You need to call this from a
> clean build directory.


I shall add that you can do that on the command line in order to
avoid bury such hint inside your CMakeLists.txt.


Note that you can usually find this piece of information in the module
documentation
(you can get it with
   cmake --help-module FindBoost
)

see:
[...]
       This module reads hints about search locations from variables:

         BOOST_ROOT             - Preferred installation prefix
          (or BOOSTROOT)
         BOOST_INCLUDEDIR       - Preferred include directory e.g.
<prefix>/include
         BOOST_LIBRARYDIR       - Preferred library directory e.g. <prefix>/lib
         Boost_NO_SYSTEM_PATHS  - Set to ON to disable searching in
locations not
                                  specified by these hint variables.
Default is OFF.
         Boost_ADDITIONAL_VERSIONS
                                - List of Boost versions not known to
this module
                                  (Boost install locations may contain
the version)
[...]


-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list