cmake: Export targets to package config

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
This commit is contained in:
Stefan Herbrechtsmeier
2017-04-04 10:34:28 +02:00
parent 4e3e3f659d
commit f186421273
2 changed files with 33 additions and 16 deletions

View File

@@ -1,4 +1,12 @@
# ZeroMQ cmake module
#
# The following import targets are created
#
# ::
#
# libzmq-static
# libzmq
#
# This module sets the following variables in your project::
#
# ZeroMQ_FOUND - true if ZeroMQ found on the system
@@ -8,8 +16,10 @@
@PACKAGE_INIT@
set(PN ZeroMQ)
set_and_check(${PN}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(${PN}_LIBRARY "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@/@libzmq_file@")
set_and_check(${PN}_STATIC_LIBRARY "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@/@libzmq_static_file@")
check_required_components(${PN})
if(NOT TARGET libzmq AND NOT TARGET libzmq-static)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
endif()
get_target_property(@PROJECT_NAME@_INCLUDE_DIR libzmq INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(@PROJECT_NAME@_LIBRARY libzmq LOCATION)
get_target_property(@PROJECT_NAME@_STATIC_LIBRARY libzmq-static LOCATION)