@@ -6,6 +6,7 @@ OPTION(JSONCPP_WITH_TESTS "Compile and run JsonCpp test executables" ON)
6
6
OPTION (JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON )
7
7
OPTION (JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF )
8
8
OPTION (JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON )
9
+ OPTION (JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF )
9
10
10
11
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
11
12
IF (NOT WIN32 )
@@ -16,6 +17,18 @@ IF(NOT WIN32)
16
17
ENDIF (NOT CMAKE_BUILD_TYPE )
17
18
ENDIF (NOT WIN32 )
18
19
20
+ SET (RUNTIME_INSTALL_DIR lib
21
+ CACHE PATH "Install dir for executables and dlls" )
22
+ SET (ARCHIVE_INSTALL_DIR lib
23
+ CACHE PATH "Install dir for static libraries" )
24
+ SET (LIBRARY_INSTALL_DIR lib
25
+ CACHE PATH "Install dir for shared libraries" )
26
+ SET (INCLUDE_INSTALL_DIR include
27
+ CACHE PATH "Install dir for headers" )
28
+ SET (PACKAGE_INSTALL_DIR lib/cmake
29
+ CACHE PATH "Install dir for cmake package config files" )
30
+ MARK_AS_ADVANCED ( RUNTIME_INSTALL_DIR ARCHIVE_INSTALL_DIR INCLUDE_INSTALL_DIR PACKAGE_INSTALL_DIR )
31
+
19
32
# This ensures shared DLL are in the same dir as executable on Windows.
20
33
# Put all executables / libraries are in a project global directory.
21
34
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} /lib
@@ -91,6 +104,12 @@ IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
91
104
DESTINATION "${CMAKE_INSTALL_PREFIX} /lib/pkgconfig" )
92
105
ENDIF (JSONCPP_WITH_PKGCONFIG_SUPPORT)
93
106
107
+ IF (JSONCPP_WITH_CMAKE_PACKAGE)
108
+ INSTALL (EXPORT jsoncpp
109
+ DESTINATION ${PACKAGE_INSTALL_DIR} /jsoncpp
110
+ FILE jsoncppConfig.cmake)
111
+ ENDIF (JSONCPP_WITH_CMAKE_PACKAGE)
112
+
94
113
# Build the different applications
95
114
ADD_SUBDIRECTORY ( src )
96
115
0 commit comments