I don't think it is possible to find both required and optional
libraries with the same find_package command. Is that true?

I have a installation of Boost which has a proposed library added into
it called Boost.Log ('log' for short). I require the
boost_program_options library but optionally can use 'log' and
'boost_thread' (if Boost.Log is compiled with threads).

My idea was to do the following:

        find_package(Boost REQUIRED program_options)
        find_library(Boost.Log NAMES boost_log PATHS
        ${BOOST_LIBRARYDIR})

I am not sure if I can use the BOOST_LIBRARYDIR in the find_library
command. My initial test says that the answer is no. If I use the above
script in my CMakeLists.txt I get:

        //Path to a library.
        Boost_LOG_LIBRARY_DEBUG:FILEPATH=Boost_LOG_LIBRARY_DEBUG-NOTFOUND
        
        //Path to a library.
        Boost_LOG_LIBRARY_RELEASE:FILEPATH=Boost_LOG_LIBRARY_RELEASE-NOTFOUND

I would like to have it so I can declare a variable to be added to the
compiler flags to enable the preprocessor to use the library or compile
out the instructions wrapped with #ifdef BOOST_LOG.

Stephen

_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to