added: use exported targets
This commit is contained in:
parent
cf26fb3550
commit
e681b47de2
@ -20,10 +20,16 @@ macro (opm_install opm)
|
||||
)
|
||||
endforeach (_hdr)
|
||||
install (
|
||||
TARGETS ${${opm}_TARGET}
|
||||
TARGETS ${${opm}_TARGET} ${${opm}_EXTRA_TARGETS}
|
||||
EXPORT ${opm}-targets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${${opm}_VER_DIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${${opm}_VER_DIR}
|
||||
)
|
||||
if(NOT "${${opm}_TARGET}" STREQUAL "")
|
||||
export(TARGETS ${${opm}_TARGET} ${${opm}_EXTRA_TARGETS}
|
||||
FILE ${opm}-targets.cmake)
|
||||
install(EXPORT ${opm}-targets DESTINATION "share/cmake/${opm}")
|
||||
endif()
|
||||
# only /usr/lib/debug seems to be searched for debug info; if we have
|
||||
# write access to that directory (package installation), then default
|
||||
# to use it; otherwise put the debug files together with the library
|
||||
|
@ -42,8 +42,8 @@ if(NOT @opm-project_NAME@_FOUND)
|
||||
# add the library as a target, so that other things in the project including
|
||||
# this file may depend on it and get rebuild if this library changes.
|
||||
if(NOT TARGET @opm-project_TARGET@)
|
||||
add_library (@opm-project_TARGET@ UNKNOWN IMPORTED)
|
||||
set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}")
|
||||
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
include("${_dir}/@opm-project_NAME@-targets.cmake")
|
||||
endif()
|
||||
endif (NOT "@opm-project_TARGET@" STREQUAL "")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user