From 5b4855dea2313e14b20de99794607780655d6521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Sun, 26 Nov 2017 10:29:51 +0100 Subject: [PATCH 1/5] fix targetname --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c7286783..89f5c221 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -101,7 +101,7 @@ foreach(file ${files}) target_compile_definitions(${testcase} PRIVATE CATCH_CONFIG_FAST_COMPILE) target_include_directories(${testcase} PRIVATE "thirdparty/catch") - target_link_libraries(${testcase} ${JSON_TARGET_NAME}) + target_link_libraries(${testcase} ${NLOHMANN_JSON_TARGET_NAME}) if(NOT MSVC) set_target_properties(${testcase} PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-float-equal") From 48d7a32daa9d0494a3e9d658ed829c1e34072f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Sun, 26 Nov 2017 10:31:33 +0100 Subject: [PATCH 2/5] add .natvis for MSVC debug view --- CMakeLists.txt | 9 ++++++++- src/json.natvis | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/json.natvis diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fb9f4c5..cc67e531 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,14 @@ target_include_directories( ${NLOHMANN_JSON_TARGET_NAME} INTERFACE $ ) - + +target_sources( + ${NLOHMANN_JSON_TARGET_NAME} + INTERFACE + $ + $ +) + ## ## TESTS ## create and configure the unit test target diff --git a/src/json.natvis b/src/json.natvis new file mode 100644 index 00000000..63e3f842 --- /dev/null +++ b/src/json.natvis @@ -0,0 +1,32 @@ + + + + null + {*(m_value.object)} + {*(m_value.array)} + {*(m_value.string)} + {m_value.boolean} + {m_value.number_integer} + {m_value.number_unsigned} + {m_value.number_float} + discarded + + + *(m_value.object),view(simple) + + + *(m_value.array),view(simple) + + + + + + + {second} + + second + + + + From af775ddbb804a2c1200ca86e882e08bc1738b75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Tue, 28 Nov 2017 23:43:39 +0100 Subject: [PATCH 3/5] add compiler & cmake version check --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc67e531..33ca38b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,12 +36,17 @@ target_include_directories( INTERFACE $ ) -target_sources( - ${NLOHMANN_JSON_TARGET_NAME} - INTERFACE - $ - $ -) +## +## add debug view defintion file for msvc +## +if (MSVC AND CMAKE_VERSION VERSION_GREATER "3.2.2") + target_sources( + ${NLOHMANN_JSON_TARGET_NAME} + INTERFACE + $ + $ + ) +endif() ## ## TESTS From 8e9a8792a9edf9921e97fdb35c95bc0f3221ec25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Thu, 30 Nov 2017 13:26:45 +0100 Subject: [PATCH 4/5] moved natis to root dir --- CMakeLists.txt | 18 ++++++++++++------ src/json.natvis => nlohmann_json.natvis | 0 2 files changed, 12 insertions(+), 6 deletions(-) rename src/json.natvis => nlohmann_json.natvis (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33ca38b0..2cd13b8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,15 +36,15 @@ target_include_directories( INTERFACE $ ) -## -## add debug view defintion file for msvc -## +## add debug view defintion file for msvc (natvis) [cmake <= 3.2.2 does not support export of source files] if (MSVC AND CMAKE_VERSION VERSION_GREATER "3.2.2") + set(NLOHMANN_ADD_NATVIS TRUE) + set(NLOHMANN_NATVIS_FILE "nlohmann_json.natvis") target_sources( ${NLOHMANN_JSON_TARGET_NAME} INTERFACE - $ - $ + $ + $ ) endif() @@ -79,6 +79,12 @@ install( FILES ${NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE} ${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE} DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR} ) +if (NLOHMANN_ADD_NATVIS) + install( + FILES ${NLOHMANN_NATVIS_FILE} + DESTINATION . +) +endif() install( TARGETS ${NLOHMANN_JSON_TARGET_NAME} EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME} @@ -87,4 +93,4 @@ install( install( EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME} DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR} -) +) \ No newline at end of file diff --git a/src/json.natvis b/nlohmann_json.natvis similarity index 100% rename from src/json.natvis rename to nlohmann_json.natvis From 24fe572d9804b7b7dd7f6b404153376b7ebe709a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Thu, 30 Nov 2017 13:37:58 +0100 Subject: [PATCH 5/5] missing new line --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cd13b8e..e3b146b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,4 +93,4 @@ install( install( EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME} DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR} -) \ No newline at end of file +)