summaryrefslogtreecommitdiffstats
path: root/rdtk/templates/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'rdtk/templates/CMakeLists.txt')
-rw-r--r--rdtk/templates/CMakeLists.txt48
1 files changed, 48 insertions, 0 deletions
diff --git a/rdtk/templates/CMakeLists.txt b/rdtk/templates/CMakeLists.txt
new file mode 100644
index 0000000..fd00820
--- /dev/null
+++ b/rdtk/templates/CMakeLists.txt
@@ -0,0 +1,48 @@
+
+if (NOT RDTK_FORCE_STATIC_BUILD)
+ include (SetFreeRDPCMakeInstallDir)
+
+ # cmake package
+ export(PACKAGE rdtk)
+
+ configure_package_config_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/rdtkConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake
+ INSTALL_DESTINATION ${RDTK_CMAKE_INSTALL_DIR}
+ PATH_VARS RDTK_INCLUDE_DIR)
+
+ write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake
+ VERSION ${RDTK_VERSION}
+ COMPATIBILITY SameMajorVersion)
+endif()
+
+set(RDTK_BUILD_CONFIG_LIST "")
+GET_CMAKE_PROPERTY(res VARIABLES)
+FOREACH(var ${res})
+ IF (var MATCHES "^WITH_*|^BUILD_TESTING|^RDTK_HAVE_*")
+ LIST(APPEND RDTK_BUILD_CONFIG_LIST "${var}=${${var}}")
+ ENDIF()
+ENDFOREACH()
+
+include(pkg-config-install-prefix)
+
+string(REPLACE ";" " " RDTK_BUILD_CONFIG "${RDTK_BUILD_CONFIG_LIST}")
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/version.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/buildflags.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/build-config.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/config.h)
+
+if (NOT RDTK_FORCE_STATIC_BUILD)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rdtk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc @ONLY)
+
+ set(RDTK_INSTALL_INCLUDE_DIR ${RDTK_INCLUDE_DIR}/rdtk)
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc
+ DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR})
+
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake
+ DESTINATION ${RDTK_CMAKE_INSTALL_DIR})
+endif()