[CMake] Is this the proper way to define a package config?
Robert Dailey
rcdailey.lists at gmail.com
Fri Oct 17 01:18:34 EDT 2014
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 )
More information about the CMake
mailing list