[CMake] Setting IMPORTED_LOCATION_* for existing packages
Hauke Heibel
hauke.heibel at googlemail.com
Wed Sep 21 03:07:29 EDT 2011
Hi,
I started to work with imported targets and thus with setting the
property IMPORTED_LOCATION and the like. I stumbled over a case
(GTest) where the standard find_package call returns me a list of libs
for 'debug' and 'optimized' modes and I am setting them like this
find_package(GTest REQUIRED)
add_library(GTest UNKNOWN IMPORTED)
foreach(arg ${GTEST_LIBRARIES})
if("${arg}" MATCHES "^(debug|optimized)$")
set(_doing "${arg}")
elseif("${_doing}" MATCHES "^debug$")
message("setting debug lib to: ${arg}")
set_target_properties(GTest PROPERTIES IMPORTED_LOCATION_DEBUG "${arg}")
else()
message("setting optimized lib to: ${arg}")
set_target_properties(GTest PROPERTIES IMPORTED_LOCATION "${arg}")
endif()
endforeach()
I am just wondering whether there is a more simple method to do this.
It looks a bit cumbersome.
Regards,
Hauke
More information about the CMake
mailing list