[CMake] Debian SID / CMake 3.5.0-1 / FindBoost / CTest

Nils Gladitz nilsgladitz at gmail.com
Tue Mar 29 04:54:27 EDT 2016


On 03/29/2016 10:31 AM, Vincent Huber wrote:
>
> Hello everyone,
>
> In a |CTest| process, I have to determine the |Boost_VERSION|.
> To do so, I just add |FIND_PACKAGE(Boost)| to my configuration file.
> I didn’t had any problems since a |cmake| update on Debian/SID to 
> cmake 3.5.0.
>
> From now, I have:
> |-- Looking for boost CMake Error at 
> /usr/share/cmake-3.5/Modules/FindBoost.cmake:896 (add_library): 
> Unknown CMake command "add_library". Call Stack (most recent call 
> first): /home/vhuber/feelpp/cmake/dashboard/testsuite.cmake:328 
> (FIND_PACKAGE)|​
>
> ​If I run a standard |cmake| process with a |FIND_PACKAGE(Boost)| 
> everything goes well.
>
> I do not clearly understand what is going on.
>

add_library() is used by an increasing number of find modules to define 
IMPORTED targets.
IMPORTED targets are the preferred and most convenient way to use 
libraries located by find modules.

Since add_library() is only meaningful in build system definitions it is 
not available to ctest.

> ​I do not have theses problems with cmake 3.4.3
>
> What can I do to solve that problem ?
>

You haven't mentioned why you need to determine the Boost version in 
your ctest script but if you do still require it I would implement 
custom logic (you could base it on the existing logic in FindBoost.cmake).

Using library find modules from any context other than cmake project 
files is ill defined even before the changes that introduced imported 
targets.
The boost find module specifically uses compiler and platform 
information that is not available in ctest scripts (e.g. boost library 
file names can be mangled differently depending on which 
compilers/versions are used and can be located differently depending on 
bitness).

Nils

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160329/05825251/attachment-0001.html>


More information about the CMake mailing list