From d1cfd6e844cc9b216b15654fba3a1ff346e5eae3 Mon Sep 17 00:00:00 2001 From: hrocho Date: Mon, 30 Nov 2020 15:39:02 +0100 Subject: [PATCH] json lib include and fetching --- CMakeLists.txt | 2 +- bin/CMakeLists.txt | 19 +++++++++++++------ bin/catima_calculator.cpp | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4500831..ffbfa8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ MESSAGE( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} ) ######## for python module find_package(PythonInterp) if(PYTHONINTERP_FOUND) - message("-- Python found: ${PYTHON_EXECUTABLE}") + message(STATUS "Python found: ${PYTHON_EXECUTABLE}") endif() if(PYTHON_MODULE) if(NOT PYTHONINTERP_FOUND) diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 3ef4f79..4f5d857 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -1,21 +1,28 @@ set(CATIMA_APPS catima_calculator) + +find_package(nlohmann_json QUIET) + +if(nlohmann_json_FOUND) +MESSAGE(STATUS "system nlohmann_json found ") +else(nlohmann_json_FOUND) +#MESSAGE(STATUS "nlohmann_json looking ") include(ExternalProject) ExternalProject_Add( json_hpp - URL https://raw.githubusercontent.com/nlohmann/json/develop/single_include/nlohmann/json.hpp - DOWNLOAD_NO_EXTRACT 1 - DOWNLOAD_NO_PROGRESS + URL https://github.com/nlohmann/json/releases/download/v3.9.1/include.zip CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" PREFIX "external" ) -ExternalProject_Get_Property(json_hpp download_dir) +ExternalProject_Get_Property(json_hpp SOURCE_DIR) +endif(nlohmann_json_FOUND) foreach(entry ${CATIMA_APPS}) add_executable(${entry} ${entry}.cpp) - target_link_libraries(${entry} catima) - target_include_directories(${entry} PRIVATE ${download_dir}) + target_link_libraries(${entry} catima ) + #target_link_libraries(${entry} PRIVATE nlohmann_json::nlohmann_json) + target_include_directories(${entry} PRIVATE ${SOURCE_DIR}/include) endforeach(entry in ${CATIMA_APPS}) install (TARGETS ${CATIMA_APPS} RUNTIME DESTINATION bin) diff --git a/bin/catima_calculator.cpp b/bin/catima_calculator.cpp index 388ca64..2b4d482 100644 --- a/bin/catima_calculator.cpp +++ b/bin/catima_calculator.cpp @@ -8,7 +8,7 @@ #include #include "catima/catima.h" #include "catima/nucdata.h" -#include "json.hpp" +#include using namespace std; using namespace catima;