Generate config header in extra module

This commit is contained in:
Martchus 2016-07-27 21:38:40 +02:00
parent 0c40a510e5
commit 2f1f20c8c3
3 changed files with 16 additions and 13 deletions

View File

@ -116,3 +116,4 @@ include(WindowsResources)
include(LibraryTarget)
include(TestTarget)
include(Doxygen)
include(ConfigHeader)

View File

@ -35,19 +35,6 @@ endif()
# set TARGET_EXECUTABLE which is used to refer to the target executable at its installation location
set(TARGET_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bin/${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}")
# find config.h template
include(TemplateFinder)
find_template_file("config.h" CPP_UTILITIES CONFIG_H_TEMPLATE_FILE)
# add configuration header
configure_file(
"${CONFIG_H_TEMPLATE_FILE}"
"${CMAKE_CURRENT_BINARY_DIR}/resources/config.h"
)
# ensure generated include files are found
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
# disable new ABI (can't catch ios_base::failure with new ABI)
option(FORCE_OLD_ABI "specifies whether usage of old ABI should be forced" OFF)
if(FORCE_OLD_ABI)

View File

@ -0,0 +1,15 @@
# before including this module, all relevant variables must be set
# (just include this module as last one since nothing should depend on it)
# find config.h template
include(TemplateFinder)
find_template_file("config.h" CPP_UTILITIES CONFIG_H_TEMPLATE_FILE)
# add configuration header
configure_file(
"${CONFIG_H_TEMPLATE_FILE}"
"${CMAKE_CURRENT_BINARY_DIR}/resources/config.h"
)
# ensure generated include files can be included via #include "resources/config.h"
include_directories("${CMAKE_CURRENT_BINARY_DIR}")