diff --git a/JSONParser/CMakeLists.txt b/JSONParser/CMakeLists.txt index b01a0ee7cb8ad66530ef95f697cdf427017f444d..f9d7939322df33f1ee90db47caaf9fa528af5682 100644 --- a/JSONParser/CMakeLists.txt +++ b/JSONParser/CMakeLists.txt @@ -4,8 +4,8 @@ cmake_minimum_required( VERSION 3.1 ) project( "JSONParser" VERSION 1.0.0 LANGUAGES CXX ) find_package( GeoModelCore REQUIRED ) -find_package( nlohmann_json REQUIRED ) -find_package(Eigen3 REQUIRED) +find_package( nlohmann_json QUIET ) +find_package( Eigen3 REQUIRED ) # Set default build options. @@ -24,7 +24,12 @@ file( GLOB HEADERS JSONParser/*.h ) add_library( JSONParser SHARED ${HEADERS} ${SOURCES} ) set_property( TARGET JSONParser 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 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> @@ -43,4 +48,3 @@ set(MYLIB_VERSION_PATCH 0) 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}) -