2023-07-23 21:08:09 +02:00
|
|
|
cmake_minimum_required(VERSION 3.17.0 FATAL_ERROR)
|
2017-10-18 23:07:17 +02:00
|
|
|
|
|
|
|
# metadata
|
|
|
|
set(META_PROJECT_TYPE library)
|
2018-01-20 18:10:58 +01:00
|
|
|
set(META_HEADER_ONLY_LIB ON)
|
2017-10-18 23:07:17 +02:00
|
|
|
|
|
|
|
# add project files
|
2021-06-06 15:06:55 +02:00
|
|
|
set(HEADER_FILES traits.h versioning.h)
|
2019-02-09 21:25:11 +01:00
|
|
|
set(SRC_FILES)
|
|
|
|
set(TEST_HEADER_FILES)
|
|
|
|
set(TEST_SRC_FILES)
|
|
|
|
set(CMAKE_MODULE_FILES cmake/modules/ReflectionGenerator.cmake)
|
|
|
|
set(DOC_FILES README.md)
|
2017-10-18 23:07:17 +02:00
|
|
|
|
2017-11-17 22:04:01 +01:00
|
|
|
# add JSON-specific sources
|
2019-02-09 21:25:11 +01:00
|
|
|
if (RapidJSON_FOUND)
|
2020-01-26 20:42:03 +01:00
|
|
|
list(
|
|
|
|
APPEND
|
|
|
|
HEADER_FILES
|
|
|
|
json/reflector.h
|
|
|
|
json/reflector-boosthana.h
|
|
|
|
json/reflector-chronoutilities.h
|
|
|
|
json/serializable.h
|
2020-02-29 22:35:02 +01:00
|
|
|
json/errorhandling.h
|
|
|
|
json/errorformatting.h)
|
2019-12-06 16:51:47 +01:00
|
|
|
list(APPEND TEST_SRC_FILES tests/jsonreflector.cpp tests/jsonreflector-boosthana.cpp
|
2020-01-26 20:42:03 +01:00
|
|
|
tests/jsonreflector-chronoutilities.cpp)
|
2019-02-09 21:25:11 +01:00
|
|
|
endif ()
|
2017-11-17 22:04:01 +01:00
|
|
|
|
2018-06-23 14:35:43 +02:00
|
|
|
# add binary (de)serialization specific sources
|
2019-12-06 16:51:47 +01:00
|
|
|
list(APPEND HEADER_FILES binary/reflector.h binary/reflector-boosthana.h binary/reflector-chronoutilities.h
|
2020-01-26 20:42:03 +01:00
|
|
|
binary/serializable.h)
|
2019-12-06 16:51:47 +01:00
|
|
|
list(APPEND TEST_SRC_FILES tests/traits.cpp tests/binaryreflector.cpp tests/binaryreflector-boosthana.cpp)
|
2018-06-23 14:35:43 +02:00
|
|
|
|
2018-01-12 15:55:10 +01:00
|
|
|
# add (only) the CMake module and include dirs for c++utilities because we're not depending on the actual library
|
2021-01-01 18:48:14 +01:00
|
|
|
use_cpp_utilities(ONLY_HEADERS VISIBILITY PUBLIC)
|
2017-10-28 18:24:12 +02:00
|
|
|
|
|
|
|
# find RapidJSON, also add only the include dirs because RapidJSON is a header-only library
|
2019-02-09 21:25:11 +01:00
|
|
|
if (RapidJSON_FOUND)
|
2019-06-20 22:53:03 +02:00
|
|
|
list(APPEND PUBLIC_INCLUDE_DIRS ${RAPIDJSON_INCLUDE_DIRS})
|
2019-02-09 21:25:11 +01:00
|
|
|
endif ()
|
2017-10-18 23:07:17 +02:00
|
|
|
|
|
|
|
# include modules to apply configuration
|
|
|
|
include(BasicConfig)
|
|
|
|
include(LibraryTarget)
|
|
|
|
include(TestTarget)
|
|
|
|
include(Doxygen)
|
|
|
|
include(ConfigHeader)
|
2020-01-31 19:27:15 +01:00
|
|
|
|
|
|
|
# export target name so the generator can link against it
|
2020-02-29 22:35:02 +01:00
|
|
|
set(${META_PROJECT_VARNAME_UPPER}_TARGET_NAME
|
|
|
|
"${META_TARGET_NAME}"
|
|
|
|
PARENT_SCOPE)
|