diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d3de8c..f5d0ff9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -263,9 +263,12 @@ else (build_errors) set(PKG_LIBRARIES ${PROJECT_NAME_LOWER}) set(PKG_DEPENDS) - configure_file( + include(CMakePackageConfigHelpers) + configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ignition-config.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake" @ONLY) + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake" + INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME_LOWER} + ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME_LOWER} COMPONENT cmake) diff --git a/cmake/ignition-config.cmake.in b/cmake/ignition-config.cmake.in index 3bfb573..f2465b8 100644 --- a/cmake/ignition-config.cmake.in +++ b/cmake/ignition-config.cmake.in @@ -3,13 +3,15 @@ if (@PKG_NAME@_CONFIG_INCLUDED) endif() set(@PKG_NAME@_CONFIG_INCLUDED TRUE) -list(APPEND @PKG_NAME@_BINARY_DIRS @CMAKE_INSTALL_PREFIX@/bin) +@PACKAGE_INIT@ -list(APPEND @PKG_NAME@_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@) +list(APPEND @PKG_NAME@_BINARY_DIRS ${PACKAGE_PREFIX_DIR}/bin) -list(APPEND @PKG_NAME@_LIBRARY_DIRS @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@) +list(APPEND @PKG_NAME@_INCLUDE_DIRS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@) -list(APPEND @PKG_NAME@_CFLAGS -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@) +list(APPEND @PKG_NAME@_LIBRARY_DIRS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@) + +list(APPEND @PKG_NAME@_CFLAGS -I${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@) list(APPEND @PKG_NAME@_CXX_FLAGS -std=c++11) if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") @@ -25,4 +27,4 @@ foreach(dep @PKG_DEPENDS@) list(APPEND @PKG_NAME@_LIBRARIES ${${dep_upper}_LIBRARIES}) endforeach() -list(APPEND @PKG_NAME@_LDFLAGS -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@) +list(APPEND @PKG_NAME@_LDFLAGS -L${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@) diff --git a/cmake/pkgconfig/ignition.in b/cmake/pkgconfig/ignition.in index 11931f4..c90dc14 100644 --- a/cmake/pkgconfig/ignition.in +++ b/cmake/pkgconfig/ignition.in @@ -1,4 +1,4 @@ -prefix=@CMAKE_INSTALL_PREFIX@ +prefix=${pcfiledir}/../.. libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@