-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
54 lines (46 loc) · 1.74 KB
/
CMakeLists.txt
File metadata and controls
54 lines (46 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Generic test that uses conan libs
add_executable(json2cpp main.cpp json2cpp.cpp)
add_executable(json2cpp::json2cpp ALIAS json2cpp)
target_link_libraries(json2cpp PRIVATE json2cpp_options json2cpp_warnings)
if(DEFINED CONAN_CXX_FLAGS)
find_package(fmt CONFIG)
find_package(spdlog CONFIG)
find_package(CLI11 CONFIG)
find_package(nlohmann_json CONFIG)
find_package(ValiJSON CONFIG)
endif()
target_link_system_libraries(
json2cpp
PRIVATE
CLI11::CLI11
fmt::fmt
spdlog::spdlog
nlohmann_json::nlohmann_json)
install(TARGETS json2cpp)
install(DIRECTORY ../include DESTINATION .)
if(json2cpp_ENABLE_LARGE_TESTS)
set(BASE_NAME "${CMAKE_CURRENT_BINARY_DIR}/schema")
add_custom_command(
DEPENDS json2cpp
OUTPUT "${BASE_NAME}_impl.hpp" "${BASE_NAME}.hpp" "${BASE_NAME}.cpp"
COMMAND json2cpp "energyplus_schema" "${CMAKE_SOURCE_DIR}/examples/Energy+.schema.epJSON" "${BASE_NAME}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(schema_validator schema_validator.cpp "${BASE_NAME}.cpp")
add_executable(json2cpp::schema_validator ALIAS schema_validator)
target_link_libraries(schema_validator PRIVATE json2cpp_options json2cpp_warnings)
target_link_system_libraries(
schema_validator
PRIVATE
CLI11::CLI11
fmt::fmt
spdlog::spdlog
ValiJSON::valijson
nlohmann_json::nlohmann_json)
target_include_directories(schema_validator PRIVATE "${CMAKE_SOURCE_DIR}/include")
target_include_directories(schema_validator PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
if(MSVC)
target_compile_options(schema_validator PRIVATE "/bigobj")
endif()
# disable analysis for these very large generated bits of code
set_target_properties(schema_validator PROPERTIES CXX_CPPCHECK "" CXX_CLANG_TIDY "")
endif()