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

Cleaning code

parent 0b6838b9
No related branches found
No related tags found
No related merge requests found
Pipeline #1597795 passed
...@@ -6,12 +6,19 @@ file( GLOB HEADERS GeoModelJSONParser/*.h ) ...@@ -6,12 +6,19 @@ file( GLOB HEADERS GeoModelJSONParser/*.h )
# Create the library. # Create the library.
add_library( GeoModelJSONParser SHARED ${HEADERS} ${SOURCES} ) add_library( GeoModelJSONParser SHARED ${HEADERS} ${SOURCES} )
if (nlohmann_json_FOUND)
# we link to nlohmann_json only if we use a version of nlohmann_json installed through CMake; # If we use standalone-build of nlohmann_json parser
if( GEOMODEL_USE_BUILTIN_JSON )
add_dependencies( GeoModelJSONParser JSON )
endif()
# We link to `nlohmann_json` only if we use a version of nlohmann_json installed through CMake;
# this is not needed if the single-header library is installed in a regular # this is not needed if the single-header library is installed in a regular
# system include folder (e.g., '/usr/local/include') # system include folder (e.g., '/usr/local/include')
if ( nlohmann_json_FOUND OR GEOMODEL_USE_BUILTIN_JSON )
target_link_libraries( GeoModelJSONParser PUBLIC nlohmann_json::nlohmann_json ) target_link_libraries( GeoModelJSONParser PUBLIC nlohmann_json::nlohmann_json )
endif() endif()
target_include_directories( GeoModelJSONParser PUBLIC target_include_directories( GeoModelJSONParser PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> )
...@@ -20,9 +27,6 @@ source_group( "src" FILES ${SOURCES} ) ...@@ -20,9 +27,6 @@ source_group( "src" FILES ${SOURCES} )
set_target_properties( GeoModelJSONParser PROPERTIES set_target_properties( GeoModelJSONParser PROPERTIES
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR} ) SOVERSION ${PROJECT_VERSION_MAJOR} )
if( GEOMODEL_USE_BUILTIN_JSON )
add_dependencies( GeoModelJSONParser JSON )
endif()
# Install the library. # Install the library.
install( TARGETS GeoModelJSONParser install( TARGETS GeoModelJSONParser
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <map> #include <map>
#include <string> #include <string>
#include "nlohmann/json.hpp" #include <nlohmann/json.hpp>
using nlohmann::json; using nlohmann::json;
......
...@@ -19,6 +19,7 @@ if( GEOMODEL_USE_BUILTIN_JSON ) ...@@ -19,6 +19,7 @@ if( GEOMODEL_USE_BUILTIN_JSON )
set( nlohmann_json_INCLUDE_DIR set( nlohmann_json_INCLUDE_DIR
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/${CMAKE_INSTALL_INCLUDEDIR}" ) "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/${CMAKE_INSTALL_INCLUDEDIR}" )
set( nlohmann_json_INCLUDE_DIRS "${nlohmann_json_INCLUDE_DIR}" ) set( nlohmann_json_INCLUDE_DIRS "${nlohmann_json_INCLUDE_DIR}" )
message(STATUS "Installing the built-in 'nlohmann_json' in: ${nlohmann_json_INCLUDE_DIR}")
# Create the include directory already, otherwise CMake refuses to # Create the include directory already, otherwise CMake refuses to
# create the imported target. # create the imported target.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment