@@ -117,10 +117,30 @@ find_package(Boost 1.65.1 COMPONENTS filesystem graph system program_options log
117117#find_package(Boost 1.72.0 COMPONENTS filesystem graph system program_options log ${BOOST_THREAD} REQUIRED)
118118include_directories (${Boost_INCLUDE_DIRS} )
119119
120- # JSON library
121- option (JSON_BuildTests OFF )
122- add_subdirectory (external/json EXCLUDE_FROM_ALL )
120+ # We need to work around the behavior of nlohmann_json_schema_validator and nlohmann_json here
121+ # The validator needs the json part, but if you include it, the library of nlohmann_json_schema_validator
122+ # is not installed, leading to linker error. But just including nlohmann_json is not sufficient, as
123+ # in the installed state the nlohmann_json_schema_validator needs the nlohmann_json package which needs
124+ # to be installed.
125+ # The following workaround may collapse or become unnecessary once the issue is
126+ # changed or fixed in nlohmann_json_schema_validator.
127+
128+ #Override option of nlohmann_json_schema_validator to not build its tests
129+ set (BUILD_TESTS OFF CACHE BOOL "Build json-schema-validator-tests" )
130+
131+ # Make nlohmann_json_schema_validator happy by telling it how to find the single include of nlohmann_json
123132include_directories (external/json/single_include/ )
133+ set (nlohmann_json_DIR ${PHASAR_SRC_DIR} /external/json/single_include/)
134+
135+ # Json Schema Validator
136+ set (JSON_VALIDATOR_INSTALL ON )
137+ add_subdirectory (external/json-schema-validator )
138+ include_directories (external/json-schema-validator/src/ )
139+
140+ # now we finally add the subdirectory
141+ set (JSON_BuildTests OFF )
142+ set (JSON_Install ON )
143+ add_subdirectory (external/json )
124144
125145# Googletest
126146if (NOT PHASAR_IN_TREE)
@@ -159,7 +179,7 @@ endif()
159179# Clang
160180# The clang-cpp shared library is now the preferred way to link dynamically against libclang if we build out of tree.
161181if (NOT PHASAR_IN_TREE)
162- find_library (CLANG_LIBRARY NAMES clang-cpp REQUIRED HINTS ${LLVM_LIBRARY_DIRS} )
182+ find_library (CLANG_LIBRARY NAMES clang-cpp libclang-cpp REQUIRED HINTS ${LLVM_LIBRARY_DIRS} )
163183 if (${CLANG_LIBRARY} STREQUAL "CLANG_LIBRARY-NOTFOUND" )
164184 set (NEED_LIBCLANG_COMPONENT_LIBS on )
165185 endif ()
0 commit comments