Adding a cmake option to exclude the jsoncpp files from install. (#1596) * Adding a cmake option to exclude the jsoncpp files from install. Useful when used used as a submodule * Updaing help text --------- Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ab9c52..4eb4499 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -79,6 +79,7 @@ option(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON) option(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" ON) option(JSONCPP_WITH_EXAMPLE "Compile JsonCpp example" OFF) +option(JSONCPP_WITH_INSTALL "Include JsonCpp header and binaries in the install target" ON) option(JSONCPP_STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" OFF) option(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." ON) option(BUILD_STATIC_LIBS "Build jsoncpp_lib as a static library." ON)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index dc40d95..bbd6405 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt
@@ -1,5 +1,8 @@ +if (JSONCPP_WITH_INSTALL) + file(GLOB INCLUDE_FILES "json/*.h") install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json) +endif() \ No newline at end of file
diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 3037eb0..86722ac 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt
@@ -196,6 +196,8 @@ list(APPEND CMAKE_TARGETS ${OBJECT_LIB}) endif() +if (JSONCPP_WITH_INSTALL) + install(TARGETS ${CMAKE_TARGETS} ${INSTALL_EXPORT} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -203,3 +205,4 @@ OBJECTS DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +endif()