-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (38 loc) · 1.23 KB
/
CMakeLists.txt
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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(cmake-uninstall NONE)
INCLUDE(CMakePackageConfigHelpers)
INCLUDE(GNUInstallDirs)
FIND_PACKAGE(cmake-version4git 0.0 QUIET)
IF(NOT cmake-version4git_FOUND)
INCLUDE(3rdparty/cmake-version4git/cmake/cmake-version4git.cmake)
ENDIF()
PROJECT_VERSION_FROM_GIT()
SET(PROJECT_CONFIG_PREFIX
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config")
SET(PROJECT_CMAKE_INSTALL_LIBDIR
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}")
WRITE_BASIC_PACKAGE_VERSION_FILE("${PROJECT_CONFIG_PREFIX}-version.cmake"
VERSION
${PROJECT_VERSION}
COMPATIBILITY
SameMajorVersion)
CONFIGURE_PACKAGE_CONFIG_FILE("cmake/${PROJECT_NAME}-config.cmake.in"
"${PROJECT_CONFIG_PREFIX}.cmake"
INSTALL_DESTINATION
"${PROJECT_CMAKE_INSTALL_LIBDIR}"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
INSTALL(FILES
"${PROJECT_CONFIG_PREFIX}-version.cmake"
"${PROJECT_CONFIG_PREFIX}.cmake"
cmake/cmake_uninstall.cmake.in
DESTINATION
"${PROJECT_CMAKE_INSTALL_LIBDIR}"
COMPONENT
Devel)
CONFIGURE_FILE(cmake/cmake_uninstall.cmake.in
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
COMMENT
"Uninstall the project...")