summaryrefslogtreecommitdiffstats
path: root/rdtk/templates/CMakeLists.txt
blob: fd00820fd118f18b188f4ce15258676e1f0a3ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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()