Make location of code generator customizable
This commit is contained in:
parent
76a8f649bc
commit
8b61fcc29a
|
@ -45,7 +45,12 @@ list(APPEND PRIVATE_LIBRARIES clangTooling)
|
|||
# also add reflective_rapidjson which is header-only but might pull additional include dirs for RapidJSON
|
||||
list(APPEND PRIVATE_LIBRARIES reflective_rapidjson)
|
||||
|
||||
# trigger code generator because the tests already contain structs to be (de)serialized
|
||||
# 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(
|
||||
INPUT_FILES
|
||||
|
@ -58,9 +63,6 @@ add_reflection_generator_invocation(
|
|||
)
|
||||
|
||||
# include modules to apply configuration
|
||||
include(BasicConfig)
|
||||
include(WindowsResources)
|
||||
include(AppTarget)
|
||||
include(TestTarget)
|
||||
include(ShellCompletion)
|
||||
include(Doxygen)
|
||||
|
|
|
@ -7,10 +7,20 @@ endif()
|
|||
set(REFLECTION_GENERATOR_MODULE_LOADED YES)
|
||||
|
||||
# find code generator
|
||||
set(REFLECTION_GENERATOR_EXECUTABLE reflective_rapidjson_generator)
|
||||
if(CMAKE_CROSSCOMPILING OR NOT TARGET "${REFLECTION_GENERATOR_EXECUTABLE}")
|
||||
# find "reflective_rapidjson_moc" from path
|
||||
find_program(REFLECTION_GENERATOR_EXECUTABLE "${REFLECTION_GENERATOR_EXECUTABLE}")
|
||||
set(DEFAULT_REFLECTION_GENERATOR_EXECUTABLE "reflective_rapidjson_generator")
|
||||
set(CUSTOM_REFLECTION_GENERATOR_EXECUTABLE "" CACHE FILEPATH "path to executable of reflection generator")
|
||||
if(CUSTOM_REFLECTION_GENERATOR_EXECUTABLE)
|
||||
# use custom generator executable
|
||||
if(NOT FILE "${CUSTOM_REFLECTION_GENERATOR_EXECUTABLE}")
|
||||
message(FATAL_ERROR "The specified code generator executable \"${CUSTOM_REFLECTION_GENERATOR_EXECUTABLE}\" does not exist.")
|
||||
endif()
|
||||
set(REFLECTION_GENERATOR_EXECUTABLE "${CUSTOM_REFLECTION_GENERATOR_EXECUTABLE}")
|
||||
elseif(CMAKE_CROSSCOMPILING OR NOT TARGET "${DEFAULT_REFLECTION_GENERATOR_EXECUTABLE}")
|
||||
# find native/external "reflective_rapidjson_generator"
|
||||
find_program(REFLECTION_GENERATOR_EXECUTABLE "${DEFAULT_REFLECTION_GENERATOR_EXECUTABLE}")
|
||||
else()
|
||||
# use "reflective_rapidjson_generator" target
|
||||
set(REFLECTION_GENERATOR_EXECUTABLE "${DEFAULT_REFLECTION_GENERATOR_EXECUTABLE}")
|
||||
endif()
|
||||
if(NOT REFLECTION_GENERATOR_EXECUTABLE)
|
||||
message(FATAL_ERROR "Unable to find executable of generator for reflection code.")
|
||||
|
|
Loading…
Reference in New Issue