From 922b56e49293806f28b8d922f4c79945e57ba816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Sat, 13 Jan 2018 12:27:33 +0100 Subject: [PATCH 1/3] cmake: add back trailing slash to NLOHMANN_JSON_SOURCE_DIR --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2acb73f..8f3d9f4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON) ## CONFIGURATION ## set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME}) -set(NLOHMANN_JSON_SOURCE_DIR "src") +set(NLOHMANN_JSON_SOURCE_DIR "src/") set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}") set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include") set(NLOHMANN_JSON_HEADER_INSTALL_DIR "${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}/nlohmann") From 84bffd5d3602010b9200b25ad09457e8bbd4cbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Sat, 13 Jan 2018 13:05:42 +0100 Subject: [PATCH 2/3] move amalgamate tool to third_party folder --- .gitignore | 1 - Makefile | 2 +- {develop => third_party}/amalgamate/CHANGES.md | 0 {develop => third_party}/amalgamate/LICENSE.md | 0 {develop => third_party}/amalgamate/README.md | 0 {develop => third_party}/amalgamate/amalgamate.py | 0 {develop => third_party}/amalgamate/config.json | 0 7 files changed, 1 insertion(+), 2 deletions(-) rename {develop => third_party}/amalgamate/CHANGES.md (100%) rename {develop => third_party}/amalgamate/LICENSE.md (100%) rename {develop => third_party}/amalgamate/README.md (100%) rename {develop => third_party}/amalgamate/amalgamate.py (100%) mode change 100755 => 100644 rename {develop => third_party}/amalgamate/config.json (100%) diff --git a/.gitignore b/.gitignore index 92ea2903..8157f1a9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,3 @@ benchmarks/files/numbers/*.json cmake-build-debug test/test-* -third_party/Amalgamate diff --git a/Makefile b/Makefile index 0029f849..8bfdb193 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ pretty: amalgamate: src/json.hpp src/json.hpp: $(SRCS) - develop/amalgamate/amalgamate.py -c develop/amalgamate/config.json -s develop --verbose=yes + third_party/amalgamate/amalgamate.py -c third_party/amalgamate/config.json -s develop --verbose=yes $(MAKE) pretty diff --git a/develop/amalgamate/CHANGES.md b/third_party/amalgamate/CHANGES.md similarity index 100% rename from develop/amalgamate/CHANGES.md rename to third_party/amalgamate/CHANGES.md diff --git a/develop/amalgamate/LICENSE.md b/third_party/amalgamate/LICENSE.md similarity index 100% rename from develop/amalgamate/LICENSE.md rename to third_party/amalgamate/LICENSE.md diff --git a/develop/amalgamate/README.md b/third_party/amalgamate/README.md similarity index 100% rename from develop/amalgamate/README.md rename to third_party/amalgamate/README.md diff --git a/develop/amalgamate/amalgamate.py b/third_party/amalgamate/amalgamate.py old mode 100755 new mode 100644 similarity index 100% rename from develop/amalgamate/amalgamate.py rename to third_party/amalgamate/amalgamate.py diff --git a/develop/amalgamate/config.json b/third_party/amalgamate/config.json similarity index 100% rename from develop/amalgamate/config.json rename to third_party/amalgamate/config.json From 5775084ffce3007224c76f53953ebca331aefb40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Sat, 13 Jan 2018 13:07:03 +0100 Subject: [PATCH 3/3] cmake: add option to use/install the non-amalgamated version --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f3d9f4d..7e427020 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,12 +16,12 @@ include(ExternalProject) ## OPTIONS ## option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON) +option(JSON_MultipleHeaders "Use non-amalgamated version of the library." OFF) ## ## CONFIGURATION ## set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME}) -set(NLOHMANN_JSON_SOURCE_DIR "src/") set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}") set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include") set(NLOHMANN_JSON_HEADER_INSTALL_DIR "${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}/nlohmann") @@ -31,6 +31,12 @@ set(NLOHMANN_JSON_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/cmake_c set(NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake") set(NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake") +if (JSON_MultipleHeaders) + set(NLOHMANN_JSON_SOURCE_DIR "develop/") +else() + set(NLOHMANN_JSON_SOURCE_DIR "src/") +endif() + ## ## TARGET ## create target and add include path @@ -40,7 +46,7 @@ add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE) target_include_directories( ${NLOHMANN_JSON_TARGET_NAME} INTERFACE - $ + $ $ )