From 4d6c4314b81a73b41a601472a392c5fa52107086 Mon Sep 17 00:00:00 2001 From: theirix Date: Thu, 14 Nov 2019 12:22:00 +0300 Subject: [PATCH 1/2] Add option JSONCPP_WITH_EXAMPLE Allows to conditionally build examples as it has been done for tests. Useful for packaging. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a7d3ef4a..19882b84f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,7 @@ option(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occ option(JSONCPP_WITH_STRICT_ISO "Issue all the warnings demanded by strict ISO C and ISO C++" ON) 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" ON) option(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF) # Enable runtime search path support for dynamic libraries on OSX @@ -228,4 +229,6 @@ add_subdirectory( src ) add_subdirectory( include ) #install the example -add_subdirectory( example ) +if(JSONCPP_WITH_EXAMPLE) + add_subdirectory( example ) +endif() From a0733bd5b7599adbfd6c96bad3e37b7c20439fd8 Mon Sep 17 00:00:00 2001 From: theirix Date: Thu, 14 Nov 2019 21:56:27 +0300 Subject: [PATCH 2/2] Do not build example by default --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19882b84f..4e0633173 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ option(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occ option(JSONCPP_WITH_STRICT_ISO "Issue all the warnings demanded by strict ISO C and ISO C++" ON) 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" ON) +option(JSONCPP_WITH_EXAMPLE "Compile JsonCpp example" OFF) option(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF) # Enable runtime search path support for dynamic libraries on OSX