diff --git a/cmake/ConfigGenerator_configureThisHost.sh.in b/cmake/ConfigGenerator_configureThisHost.sh.in new file mode 100755 index 0000000000000000000000000000000000000000..d8782a481cd7dbab373e44ca1f1eb854d644d79b --- /dev/null +++ b/cmake/ConfigGenerator_configureThisHost.sh.in @@ -0,0 +1,16 @@ +#!/bin/bash + +## The purpose of this script is to call the correct version of the config +## generator for a particulat server config. The directory with the +## config generator version is put into a template by cmake, and this script +## is placed into the actual server config directory. + +server_type="$1" +if [[ -z ${server_type} ]]; then + echo "No server type given at command line." + exit 1 +fi + +export CFGDIR="$(dirname "$(which "$0")")" + +@ConfigGenerator_DIR@/config myself --type ${server_type} diff --git a/cmake/config_generator_project.cmake b/cmake/config_generator_project.cmake index 837e72a7ecb19c0fadeadfa205ecdfc03ae8bc68..7835961632ac8204e37baee89cf141b359333c35 100644 --- a/cmake/config_generator_project.cmake +++ b/cmake/config_generator_project.cmake @@ -18,9 +18,10 @@ cmake_minimum_required(VERSION 3.14) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) -find_package(ConfigGenerator 02.00 REQUIRED) +find_package(ConfigGenerator 03.00 REQUIRED) list(APPEND CMAKE_MODULE_PATH ${ConfigGenerator_DIR}/shared) + set(DESTDIR share/ConfigGenerator-${PROJECT_NAME}-${${PROJECT_NAME}_MAJOR_VERSION}-${${PROJECT_NAME}_MINOR_VERSION}) # find all server type directories in our source directory and copy them to the build directory @@ -34,6 +35,10 @@ foreach(hostlist ${hostlists}) list(APPEND servertypes "${servertype}") endforeach() +# prepare a configure script which knows the version of config generator to call +configure_file(${PROJECT_SOURCE_DIR}/cmake/ConfigGenerator_configureThisHost.sh.in ${PROJECT_BINARY_DIR}/configureThisHost.sh @ONLY) + + # install server types (scripts are installed by upstream config generator project) foreach(servertype ${servertypes}) install(DIRECTORY "${servertype}/settings" DESTINATION "${DESTDIR}/${servertype}") @@ -41,3 +46,5 @@ foreach(servertype ${servertypes}) file(GLOB thefiles LIST_DIRECTORIES no "${servertype}/*") install(FILES ${thefiles} DESTINATION "${DESTDIR}/${servertype}") endforeach() + +install(PROGRAMS ${PROJECT_BINARY_DIR}/configureThisHost.sh DESTINATION "${DESTDIR}" )