@@ -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 )
@@ -24,7 +25,9 @@ SET(LIBRARY_INSTALL_DIR lib
24
25
CACHE PATH "Install dir for shared libraries" )
25
26
SET (INCLUDE_INSTALL_DIR include
26
27
CACHE PATH "Install dir for headers" )
27
- MARK_AS_ADVANCED ( RUNTIME_INSTALL_DIR ARCHIVE_INSTALL_DIR INCLUDE_INSTALL_DIR )
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 )
28
31
29
32
# This ensures shared DLL are in the same dir as executable on Windows.
30
33
# Put all executables / libraries are in a project global directory.
@@ -101,6 +104,12 @@ IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
101
104
DESTINATION "${CMAKE_INSTALL_PREFIX} /lib/pkgconfig" )
102
105
ENDIF (JSONCPP_WITH_PKGCONFIG_SUPPORT)
103
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
+
104
113
# Build the different applications
105
114
ADD_SUBDIRECTORY ( src )
106
115
0 commit comments