I have a local package of boost built on Windows. It is always
relative to the root of my project at a consistent structure and
location. I wanted to define an import target for this and thought it
might be best to define a BoostConfig.cmake package config file at the
root of the boost lib directory. Is this the right approach? The code
is below.

Note that I do not have this working just yet because I don't know how
to properly setup the interface link libraries. Could use some
guidance here too... thanks.

add_library( Boost STATIC IMPORTED GLOBAL )

file( GLOB boost_debug_libs ${CMAKE_CURRENT_LIST_DIR}/lib/win32/debug/*.lib )
file( GLOB boost_release_libs
${CMAKE_CURRENT_LIST_DIR}/lib/win32/release/*.lib )

set_target_properties( Boost PROPERTIES
    IMPORTED_LOCATION_DEBUG lib/win32/debug
    IMPORTED_LOCATION_RELEASE lib/win32/release
    INTERFACE_INCLUDE_DIRECTORIES include
    INTERFACE_LINK_LIBRARIES
        $<$<CONFIG:Debug>:${boost_debug_libs}>
        $<$<CONFIG:Release>:${boost_release_libs}>
)

set( Boost_INCLUDE_DIRS include )
set( Boost_LIBRARIES Boost )
-- 

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