1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-22 10:18:50 -05:00

json lib include and fetching

This commit is contained in:
hrocho 2020-11-30 15:39:02 +01:00
parent 25cbcdcb25
commit d1cfd6e844
3 changed files with 15 additions and 8 deletions

View File

@ -97,7 +97,7 @@ MESSAGE( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} )
######## for python module ######## for python module
find_package(PythonInterp) find_package(PythonInterp)
if(PYTHONINTERP_FOUND) if(PYTHONINTERP_FOUND)
message("-- Python found: ${PYTHON_EXECUTABLE}") message(STATUS "Python found: ${PYTHON_EXECUTABLE}")
endif() endif()
if(PYTHON_MODULE) if(PYTHON_MODULE)
if(NOT PYTHONINTERP_FOUND) if(NOT PYTHONINTERP_FOUND)

View File

@ -1,21 +1,28 @@
set(CATIMA_APPS catima_calculator) 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) include(ExternalProject)
ExternalProject_Add( ExternalProject_Add(
json_hpp json_hpp
URL https://raw.githubusercontent.com/nlohmann/json/develop/single_include/nlohmann/json.hpp URL https://github.com/nlohmann/json/releases/download/v3.9.1/include.zip
DOWNLOAD_NO_EXTRACT 1
DOWNLOAD_NO_PROGRESS
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
PREFIX "external" PREFIX "external"
) )
ExternalProject_Get_Property(json_hpp download_dir) ExternalProject_Get_Property(json_hpp SOURCE_DIR)
endif(nlohmann_json_FOUND)
foreach(entry ${CATIMA_APPS}) foreach(entry ${CATIMA_APPS})
add_executable(${entry} ${entry}.cpp) add_executable(${entry} ${entry}.cpp)
target_link_libraries(${entry} catima) target_link_libraries(${entry} catima )
target_include_directories(${entry} PRIVATE ${download_dir}) #target_link_libraries(${entry} PRIVATE nlohmann_json::nlohmann_json)
target_include_directories(${entry} PRIVATE ${SOURCE_DIR}/include)
endforeach(entry in ${CATIMA_APPS}) endforeach(entry in ${CATIMA_APPS})
install (TARGETS ${CATIMA_APPS} RUNTIME DESTINATION bin) install (TARGETS ${CATIMA_APPS} RUNTIME DESTINATION bin)

View File

@ -8,7 +8,7 @@
#include <stdexcept> #include <stdexcept>
#include "catima/catima.h" #include "catima/catima.h"
#include "catima/nucdata.h" #include "catima/nucdata.h"
#include "json.hpp" #include <nlohmann/json.hpp>
using namespace std; using namespace std;
using namespace catima; using namespace catima;