@@ -15,6 +15,8 @@ set(CMAKE_CXX_STANDARD 17)
1515set (CMAKE_CXX_STANDARD_REQUIRED ON )
1616set (CMAKE_CXX_EXTENSIONS OFF )
1717
18+ include (GNUInstallDirs )
19+
1820set_property (GLOBAL PROPERTY TARGET_MESSAGES OFF )
1921
2022if (NOT CMAKE_BUILD_TYPE )
@@ -99,7 +101,10 @@ include_directories(
99101 ${PHASAR_SRC_DIR} /include
100102)
101103
102- set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX} /lib" )
104+
105+ set (PHASAR_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR} /phasar)
106+
107+ set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX} /${PHASAR_INSTALL_LIBDIR} )
103108set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
104109
105110if (LLVM_ENABLE_LIBCXX)
@@ -117,14 +122,36 @@ find_package(Boost 1.65.1 COMPONENTS filesystem graph system program_options log
117122#find_package(Boost 1.72.0 COMPONENTS filesystem graph system program_options log ${BOOST_THREAD} REQUIRED)
118123include_directories (${Boost_INCLUDE_DIRS} )
119124
120- # JSON library
121- option (JSON_BuildTests OFF )
122- add_subdirectory (external/json EXCLUDE_FROM_ALL )
125+ # We need to work around the behavior of nlohmann_json_schema_validator and nlohmann_json here
126+ # The validator needs the json part, but if you include it, the library of nlohmann_json_schema_validator
127+ # is not installed, leading to linker error. But just including nlohmann_json is not sufficient, as
128+ # in the installed state the nlohmann_json_schema_validator needs the nlohmann_json package which needs
129+ # to be installed.
130+ # The following workaround may collapse or become unnecessary once the issue is
131+ # changed or fixed in nlohmann_json_schema_validator.
132+
133+ #Override option of nlohmann_json_schema_validator to not build its tests
134+ set (BUILD_TESTS OFF CACHE BOOL "Build json-schema-validator-tests" )
135+
136+ # Make nlohmann_json_schema_validator happy by telling it how to find the single include of nlohmann_json
123137include_directories (external/json/single_include/ )
138+
124139if (PHASAR_IN_TREE)
125140 set_property (GLOBAL APPEND PROPERTY LLVM_EXPORTS nlohmann_json_schema_validator )
126141endif ()
127142
143+ set (nlohmann_json_DIR ${PHASAR_SRC_DIR} /external/json/single_include/)
144+
145+ # Json Schema Validator
146+ set (JSON_VALIDATOR_INSTALL ON )
147+ add_subdirectory (external/json-schema-validator )
148+ include_directories (external/json-schema-validator/src/ )
149+
150+ # now we finally add the subdirectory
151+ set (JSON_BuildTests OFF )
152+ set (JSON_Install ON )
153+ add_subdirectory (external/json )
154+
128155# Googletest
129156if (NOT PHASAR_IN_TREE)
130157 add_subdirectory (external/googletest EXCLUDE_FROM_ALL )
@@ -162,7 +189,7 @@ endif()
162189# Clang
163190# The clang-cpp shared library is now the preferred way to link dynamically against libclang if we build out of tree.
164191if (NOT PHASAR_IN_TREE)
165- find_library (CLANG_LIBRARY NAMES clang-cpp REQUIRED HINTS ${LLVM_LIBRARY_DIRS} )
192+ find_library (CLANG_LIBRARY NAMES clang-cpp libclang-cpp REQUIRED HINTS ${LLVM_LIBRARY_DIRS} )
166193 if (${CLANG_LIBRARY} STREQUAL "CLANG_LIBRARY-NOTFOUND" )
167194 set (NEED_LIBCLANG_COMPONENT_LIBS on )
168195 endif ()
0 commit comments