[libsigcplusplus/cmake-integration] cmake: fix generating cmake *Config files
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/cmake-integration] cmake: fix generating cmake *Config files
- Date: Sat, 12 Mar 2016 19:30:39 +0000 (UTC)
commit f4565d86031ea6f09c296e34f422020475368bef
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Mar 12 20:06:28 2016 +0100
cmake: fix generating cmake *Config files
CMakeLists.txt | 55 ++++++++++++++++++++++++--------------
cmake/libsigcxx-3Config.cmake.in | 3 --
cmake/sigc++-3Config.cmake.in | 5 +++
sigc++/CMakeLists.txt | 20 +++++++-------
4 files changed, 50 insertions(+), 33 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d63411..7715d5d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,36 +56,51 @@ add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
-set(version_config "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
-set(project_config "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
-set(config_install_dir "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}")
-
-include(CMakePackageConfigHelpers)
-write_basic_package_version_file("${version_config}" VERSION ${PACKAGE_VERSION} COMPATIBILITY
SameMajorVersion)
-configure_package_config_file(cmake/libsigcxx-3Config.cmake.in "${project_config}" INSTALL_DESTINATION
"${config_install_dir}")
+install (FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/sigc++config.h"
+ DESTINATION
+ "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}-${SIGCXX_API_VERSION}/include")
install (FILES
"${CMAKE_CURRENT_BINARY_DIR}/sigc++-${SIGCXX_API_VERSION}.pc"
DESTINATION
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
-install (FILES
- "${project_config}"
- "${version_config}"
- DESTINATION
- "${config_install_dir}")
-
-install (FILES
- "${CMAKE_CURRENT_BINARY_DIR}/sigc++config.h"
- DESTINATION
- "${CMAKE_INSTALL_PREFIX}/lib/sigc++-3.0/include")
-
-
+enable_testing()
-enable_testing()
add_subdirectory (sigc++)
add_subdirectory (examples)
add_subdirectory (tests)
+
+set (PROJECT_CMAKE_NAME "${PROJECT_NAME}-3")
+set (VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_CMAKE_NAME}ConfigVersion.cmake")
+set (LIBSIGCXX_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}-${SIGCXX_API_VERSION}/include")
+set (PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_CMAKE_NAME}Config.cmake")
+set (CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_CMAKE_NAME}")
+set (TARGETS_EXPORT_NAME "${PROJECT_CMAKE_NAME}Targets")
+include (CMakePackageConfigHelpers)
+
+write_basic_package_version_file (
+ "${VERSION_CONFIG}"
+ VERSION ${PACKAGE_VERSION}
+ COMPATIBILITY SameMajorVersion
+)
+
+configure_package_config_file (
+ "cmake/sigc++-3Config.cmake.in"
+ "${PROJECT_CONFIG}"
+ INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
+)
+
+install (
+ FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
+ DESTINATION "${CONFIG_INSTALL_DIR}"
+)
+
+install (
+ EXPORT "${TARGETS_EXPORT_NAME}"
+ DESTINATION "${CONFIG_INSTALL_DIR}"
+)
\ No newline at end of file
diff --git a/cmake/sigc++-3Config.cmake.in b/cmake/sigc++-3Config.cmake.in
new file mode 100644
index 0000000..145c450
--- /dev/null
+++ b/cmake/sigc++-3Config.cmake.in
@@ -0,0 +1,5 @@
+ PACKAGE_INIT@
+
+include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME cmake")
+include_directories("@LIBSIGCXX_INCLUDE_DIR@")
+check_required_components("@PROJECT_NAME@")
\ No newline at end of file
diff --git a/sigc++/CMakeLists.txt b/sigc++/CMakeLists.txt
index 5d3945e..f203d51 100644
--- a/sigc++/CMakeLists.txt
+++ b/sigc++/CMakeLists.txt
@@ -30,19 +30,19 @@ add_library(${SIGCPP_LIB_NAME} SHARED ${SOURCE_FILES})
set_property (TARGET ${SIGCPP_LIB_NAME} PROPERTY VERSION ${PACKAGE_VERSION})
set_property(TARGET ${SIGCPP_LIB_NAME} PROPERTY SOVERSION ${LIBSIGCPP_SOVERSION})
+set (INCLUDE_INSTALL_DIR "include/${PROJECT_NAME}-${SIGCXX_API_VERSION}")
+
install (
- TARGETS
- ${SIGCPP_LIB_NAME}
- DESTINATION
- lib
+ DIRECTORY "${PROJECT_SOURCE_DIR}"
+ DESTINATION "${INCLUDE_INSTALL_DIR}"
+ FILES_MATCHING PATTERN "*.h"
)
+set (PROJECT_CMAKE_NAME ${PROJECT_NAME}-3)
install (
- DIRECTORY
- "${PROJECT_SOURCE_DIR}"
- DESTINATION
- "include/${PROJECT_NAME}-${SIGCXX_API_VERSION}"
- FILES_MATCHING PATTERN
- "*.h"
+ TARGETS ${SIGCPP_LIB_NAME}
+ EXPORT "${PROJECT_CMAKE_NAME}Targets"
+ LIBRARY DESTINATION "lib"
+ INCLUDES DESTINATION "${INCLUDE_INSTALL_DIR}"
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]