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

Fix farther installation case of nlohmann for Visualization

parent 58bddb43
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" )
set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" )
set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" )
# # Make the module directory visible to CMake.
# Make the module directory visible to CMake.
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
#
# # Use the GNU install directory names.
......
......@@ -66,11 +66,20 @@ endif()
target_link_libraries (GXClashPointSystems PRIVATE SoQt::SoQt Coin::Coin ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} )
# 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
# system include folder (e.g., '/usr/local/include')
if( nlohmann_json_FOUND )
# We link to `nlohmann_json` only if we use a version of nlohmann_json
# that provides a CMake config file (i.e., either built from source, or also
# installed with Homebrew on macOS).
# This is not needed if the single-header library is installed in a regular
# system include folder (e.g., '/usr/local/include', '/usr/include', ...)
# Also, note that nlohmann_json has been found (or not) at the root level already,
# but apparently it needs to be "found" here again,
# otherwise the nlohmann_json CMake config file is not found properly.
# Thus, in case SetupJSON.cmake finds it at root level, the variable
# SetupJSON_nlohmann_json_FOUND is set to true, and here we "find" nlohmann_json
# again. (TODO: to be investigated if we can simplify all that: ideally,
# finding it at root level inside SetupJSON.cmake should be enough.)
if ( nlohmann_json_FOUND OR SetupJSON_nlohmann_json_FOUND )
find_package(nlohmann_json QUIET)
target_link_libraries( GXClashPointSystems PUBLIC nlohmann_json::nlohmann_json )
endif()
......
......@@ -62,10 +62,20 @@ include_directories(${SoQt_INCLUDE_DIRS} )
include_directories(${VP1HEPVis_INCLUDE_DIRS} )
# 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
# system include folder (e.g., '/usr/local/include')
if( nlohmann_json_FOUND )
# We link to `nlohmann_json` only if we use a version of nlohmann_json
# that provides a CMake config file (i.e., either built from source, or also
# installed with Homebrew on macOS).
# This is not needed if the single-header library is installed in a regular
# system include folder (e.g., '/usr/local/include', '/usr/include', ...)
# Also, note that nlohmann_json has been found (or not) at the root level already,
# but apparently it needs to be "found" here again,
# otherwise the nlohmann_json CMake config file is not found properly.
# Thus, in case SetupJSON.cmake finds it at root level, the variable
# SetupJSON_nlohmann_json_FOUND is set to true, and here we "find" nlohmann_json
# again. (TODO: to be investigated if we can simplify all that: ideally,
# finding it at root level inside SetupJSON.cmake should be enough.)
if ( nlohmann_json_FOUND OR SetupJSON_nlohmann_json_FOUND )
find_package(nlohmann_json QUIET)
target_link_libraries( GXGeometrySystems nlohmann_json::nlohmann_json )
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment