forked from biojppm/rapidyaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
27 lines (22 loc) · 1.05 KB
/
CMakeLists.txt
File metadata and controls
27 lines (22 loc) · 1.05 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
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(ryml-quickstart-ints LANGUAGES CXX)
# create a target to amalgamate ryml into a single header:
include(../singleheader-ints/amalgamate.cmake)
amalgamate_ryml(SINGLE_HEADER_DIR SINGLE_HEADER)
# add a library using the amalgamated header
add_library(ryml lib.cpp ${SINGLE_HEADER})
target_compile_features(ryml PUBLIC cxx_std_11)
target_include_directories(ryml PUBLIC "${SINGLE_HEADER_DIR}")
# now simply define the executable:
add_executable(ryml-quickstart-ints ../quickstart-ints.cpp)
target_link_libraries(ryml-quickstart-ints PRIVATE ryml)
target_compile_definitions(ryml-quickstart-ints PUBLIC -DRYML_SINGLE_HEADER_LIB)
target_compile_definitions(ryml-quickstart-ints PUBLIC -DRYML_SINGLE_HEADER_INTS)
# adjustments for shared library
if(BUILD_SHARED_LIBS)
# RYML_SHARED should be propagated to targets consuming ryml
target_compile_definitions(ryml PUBLIC -DRYML_SHARED)
endif()
add_custom_target(run ryml-quickstart-ints
COMMAND $<TARGET_FILE:ryml-quickstart-ints>
DEPENDS ryml-quickstart-ints)