Imported Upstream version 2.99.9 (LGPL3)
[platform/upstream/libsigc++.git] / CMakeLists.txt
1 # Copyright 2016, The libsigc++ Development Team
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17 cmake_minimum_required (VERSION 3.2)
18
19 set (SIGCXX_MAJOR_VERSION 2)
20 set (SIGCXX_MINOR_VERSION 99)
21 set (SIGCXX_MICRO_VERSION 1)
22
23 set (SIGCXX_API_VERSION 3.0)
24 set (PACKAGE_VERSION ${SIGCXX_MAJOR_VERSION}.${SIGCXX_MINOR_VERSION}.${SIGCXX_MICRO_VERSION})
25 set (LIBSIGCPP_SOVERSION 0)
26
27 option (SIGCXX_DISABLE_DEPRECATED "Disable deprecated" OFF)
28
29 project (sigc++)
30
31 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
32
33 set (PROJECT_SOURCE_DIR "${sigc++_SOURCE_DIR}/sigc++")
34
35 include_directories (${sigc++_SOURCE_DIR})
36 include_directories (${sigc++_BINARY_DIR})
37
38 configure_file (sigc++config.h.cmake sigc++config.h)
39
40 set (prefix ${CMAKE_INSTALL_PREFIX})
41 set (exec_prefix \${prefix})
42 set (libdir \${exec_prefix}/lib)
43 set (datarootdir \${prefix})
44 set (datadir \${datarootdir})
45 set (includedir \${prefix}/include)
46 set (top_srcdir .)
47 configure_file (sigc++.pc.in sigc++-${SIGCXX_API_VERSION}.pc @ONLY)
48 configure_file (sigc++-uninstalled.pc.in sigc++-${SIGCXX_API_VERSION}-uninstalled.pc @ONLY)
49
50 configure_file(
51         "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
52         "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
53         IMMEDIATE @ONLY)
54
55 add_custom_target(uninstall
56         COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
57
58
59 install (FILES
60                         "${CMAKE_CURRENT_BINARY_DIR}/sigc++config.h"
61                 DESTINATION
62                         "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}-${SIGCXX_API_VERSION}/include")
63
64 install (FILES 
65                         "${CMAKE_CURRENT_BINARY_DIR}/sigc++-${SIGCXX_API_VERSION}.pc"
66                 DESTINATION 
67                         "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
68
69 enable_testing()
70
71
72
73 add_subdirectory (sigc++)
74 add_subdirectory (examples)
75 add_subdirectory (tests)
76
77
78 set (PROJECT_CMAKE_NAME         "${PROJECT_NAME}-3")
79 set (VERSION_CONFIG             "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_CMAKE_NAME}ConfigVersion.cmake")
80 set (LIBSIGCXX_INCLUDE_DIR      "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}-${SIGCXX_API_VERSION}/include")
81 set (PROJECT_CONFIG             "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_CMAKE_NAME}Config.cmake")
82 set (CONFIG_INSTALL_DIR         "lib/cmake/${PROJECT_CMAKE_NAME}")
83 set (TARGETS_EXPORT_NAME    "${PROJECT_CMAKE_NAME}Targets")
84 include (CMakePackageConfigHelpers)
85
86 write_basic_package_version_file (
87     "${VERSION_CONFIG}"
88     VERSION ${PACKAGE_VERSION}
89     COMPATIBILITY SameMajorVersion
90 )
91
92 configure_package_config_file (
93     "cmake/sigc++-3Config.cmake.in"
94     "${PROJECT_CONFIG}"
95     INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
96 )
97
98 install (
99     FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
100     DESTINATION "${CONFIG_INSTALL_DIR}"
101 )
102
103 install (
104     EXPORT "${TARGETS_EXPORT_NAME}"
105     DESTINATION "${CONFIG_INSTALL_DIR}"
106 )