Skip to content
Snippets Groups Projects
Commit df0538d2 authored by Riccardo Maria Bianchi's avatar Riccardo Maria Bianchi :sunny:
Browse files

Fix include of nlohmann_json dependency

parent e80c117a
No related branches found
No related tags found
No related merge requests found
...@@ -4,8 +4,8 @@ cmake_minimum_required( VERSION 3.1 ) ...@@ -4,8 +4,8 @@ cmake_minimum_required( VERSION 3.1 )
project( "JSONParser" VERSION 1.0.0 LANGUAGES CXX ) project( "JSONParser" VERSION 1.0.0 LANGUAGES CXX )
find_package( GeoModelCore REQUIRED ) find_package( GeoModelCore REQUIRED )
find_package( nlohmann_json REQUIRED ) find_package( nlohmann_json QUIET )
find_package(Eigen3 REQUIRED) find_package( Eigen3 REQUIRED )
# Set default build options. # Set default build options.
...@@ -24,7 +24,12 @@ file( GLOB HEADERS JSONParser/*.h ) ...@@ -24,7 +24,12 @@ file( GLOB HEADERS JSONParser/*.h )
add_library( JSONParser SHARED ${HEADERS} ${SOURCES} ) add_library( JSONParser SHARED ${HEADERS} ${SOURCES} )
set_property( TARGET JSONParser set_property( TARGET JSONParser
PROPERTY PUBLIC_HEADER ${HEADERS} ) PROPERTY PUBLIC_HEADER ${HEADERS} )
target_link_libraries( JSONParser PUBLIC nlohmann_json::nlohmann_json GeoModelCore::GeoModelKernel ) if( NLOHMANN_JSON_FOUND )
target_link_libraries( JSONParser PUBLIC nlohmann_json::nlohmann_json GeoModelCore::GeoModelKernel )
else()
message(STATUS "'nlohmann_json' not found by CMake!! Anyway, if you installed the single header file in a standard system include dir, I will be able to use it.")
target_link_libraries( JSONParser PUBLIC GeoModelCore::GeoModelKernel )
endif()
target_include_directories( JSONParser SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR} ) target_include_directories( JSONParser SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR} )
target_include_directories( JSONParser PUBLIC target_include_directories( JSONParser PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
...@@ -43,4 +48,3 @@ set(MYLIB_VERSION_PATCH 0) ...@@ -43,4 +48,3 @@ set(MYLIB_VERSION_PATCH 0)
set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH}) set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH})
set_target_properties(JSONParser PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR}) set_target_properties(JSONParser PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment