cpp-utilities/cmake/modules/ConfigHeader.cmake

20 lines
670 B
CMake
Raw Normal View History

2016-07-27 21:38:40 +02:00
# before including this module, all relevant variables must be set
2017-02-11 02:30:46 +01:00
# just include this module as last one since nothing should depend on it
if(NOT TARGET_CONFIG_DONE)
message(FATAL_ERROR "Before including the ConfigHeader module, the BasicConfig module must be included.")
endif()
2016-07-27 21:38:40 +02:00
# 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}")