@@ -2,15 +2,45 @@ cmake_minimum_required(VERSION 3.15)
22
33project (
44 ProcessInfo
5- VERSION 0.1
5+ VERSION 1.0.0
66 LANGUAGES CXX )
77
88set (CMAKE_CXX_STANDARD 20)
99set (CMAKE_CXX_EXTENSIONS OFF )
1010set (CMAKE_CXX_STANDARD_REQUIRED ON )
1111
12- include_directories (src )
13- link_directories (${CMAKE_BINARY_DIR } /src )
12+ include (GNUInstallDirs )
13+
14+ option (PROCESSINFO_PKGCONFIG "Build pkg-config .pc file for ProcessInfo library." OFF )
15+ option (PROCESSINFO_EXAMPLES "Build examples for ProcessInfo library." OFF )
16+
17+ set (INCLUDE_INSTALL_DIR
18+ "${CMAKE_INSTALL_INCLUDEDIR} /ProcessInfo"
19+ CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where ProcessInfo header files are installed" )
20+
21+
22+ set (PKGCONFIG_INSTALL_DIR
23+ "${CMAKE_INSTALL_DATADIR} /pkgconfig"
24+ CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where processinfo.pc is installed"
25+ )
26+
27+ foreach (var INCLUDE_INSTALL_DIR CMAKEPACKAGE_INSTALL_DIR PKGCONFIG_INSTALL_DIR)
28+ # If an absolute path is specified, make it relative to "{CMAKE_INSTALL_PREFIX}".
29+ if (IS_ABSOLUTE "${${var} }" )
30+ file (RELATIVE_PATH "${var} " "${CMAKE_INSTALL_PREFIX } " "${${var} }" )
31+ endif ()
32+ endforeach ()
1433
1534add_subdirectory (src )
16- add_subdirectory (examples )
35+
36+ if (PROCESSINFO_EXAMPLES)
37+ include_directories (src )
38+ link_directories (${CMAKE_BINARY_DIR } /src )
39+ add_subdirectory (examples )
40+ endif ()
41+
42+ if (COROUTINECLASSES_PKGCONFIG)
43+ configure_file (processinfo.pc.in processinfo.pc @ONLY )
44+ install (FILES ${CMAKE_CURRENT_BINARY_DIR } /processinfo.pc
45+ DESTINATION ${PKGCONFIG_INSTALL_DIR} )
46+ endif ()
0 commit comments