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

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to