-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
14 lines (11 loc) · 620 Bytes
/
CMakeLists.txt
File metadata and controls
14 lines (11 loc) · 620 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
cmake_minimum_required(VERSION 3.15)
project(PackageTest CXX)
find_package(json2cpp CONFIG REQUIRED)
set(COMPILED_JSON "${CMAKE_CURRENT_BINARY_DIR}/test_json")
add_custom_command(
OUTPUT "${COMPILED_JSON}_impl.hpp" "${COMPILED_JSON}.hpp" "${COMPILED_JSON}.cpp"
COMMAND json2cpp "test_json" "${CMAKE_SOURCE_DIR}/test.json" "${COMPILED_JSON}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(example src/example.cpp "${COMPILED_JSON}.cpp")
target_link_libraries(example PRIVATE json2cpp::json2cpp_headers)
target_include_directories(example PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")