reflective-rapidjson/generator/CMakeLists.txt

75 lines
2.1 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# metadata
2017-10-25 17:41:19 +02:00
set(META_PROJECT_NAME reflective_rapidjson_generator)
set(META_PROJECT_TYPE application)
set(LINK_TESTS_AGAINST_APP_TARGET ON)
# add project files
set(HEADER_FILES
2017-10-25 15:38:45 +02:00
codegenerator.h
jsonserializationcodegenerator.h
2017-10-25 15:38:45 +02:00
codefactory.h
frontendaction.h
consumer.h
visitor.h
clangversionabstraction.h
)
set(SRC_FILES
2017-10-25 15:38:45 +02:00
codegenerator.cpp
jsonserializationcodegenerator.cpp
2017-10-25 15:38:45 +02:00
codefactory.cpp
frontendaction.cpp
consumer.cpp
clangversionabstraction.cpp
visitor.cpp
main.cpp
)
set(TEST_HEADER_FILES
tests/structs.h
tests/helper.h
)
set(TEST_SRC_FILES
tests/cppunit.cpp
tests/jsongenerator.cpp
)
2017-10-28 18:24:12 +02:00
# find c++utilities and link against the library
2017-11-06 20:04:42 +01:00
find_package(c++utilities 4.12.0 REQUIRED)
use_cpp_utilities()
2017-10-28 18:24:12 +02:00
# find Clang for LibTooling; adding clangTooling should be sufficient as it pulls all transitive dependencies
find_package(Clang REQUIRED)
list(APPEND PRIVATE_LIBRARIES clangTooling)
2017-10-28 18:24:12 +02:00
# also add reflective_rapidjson which is header-only but might pull additional include dirs for RapidJSON
list(APPEND PRIVATE_LIBRARIES reflective_rapidjson)
# include modules to apply configuration
include(BasicConfig)
include(WindowsResources)
include(AppTarget)
# trigger code generator for tests because the tests already contain structs to be (de)serialized
include(ReflectionGenerator)
add_reflection_generator_invocation(
2017-10-28 18:24:12 +02:00
INPUT_FILES
tests/structs.h # used by test cases
tests/cppunit.cpp # just for testing multiple input files and the "empty file" case
2017-10-28 18:24:12 +02:00
GENERATORS
json
OUTPUT_LISTS
TEST_HEADER_FILES
JSON_CLASSES
OtherNotJsonSerializable # test specifying classes for JSON (de)serialization manually
SomeOtherClassName # specifying a class that does not exist should not cause any problems
JSON_VISIBILITY
LIB_EXPORT # not required, just to test setting visibility
)
# include modules to apply configuration
include(TestTarget)
include(ShellCompletion)
include(Doxygen)
include(ConfigHeader)