diff --git a/Core/CppMicroServices/CMake/usFunctionGenerateExecutableInit.cmake b/Core/CppMicroServices/CMake/usFunctionGenerateExecutableInit.cmake index fc4030cf80..44f3bbdcd3 100644 --- a/Core/CppMicroServices/CMake/usFunctionGenerateExecutableInit.cmake +++ b/Core/CppMicroServices/CMake/usFunctionGenerateExecutableInit.cmake @@ -1,43 +1,43 @@ #! \ingroup MicroServicesCMake #! \brief Generate a source file which handles proper initialization of an executable. #! #! This CMake function will store the path to a generated source file in the #! src_var variable, which should be compiled into an executable. Example usage: #! #! \code{.cmake} #! set(executable_srcs ) #! usFunctionGenerateExecutableInit(executable_srcs #! IDENTIFIER "MyExecutable" #! ) #! add_executable(MyExecutable ${executable_srcs}) #! \endcode #! #! \param src_var (required) The name of a list variable to which the path of the generated #! source file will be appended. #! \param IDENTIFIER (required) A valid C identifier for the executable. #! #! \see #usFunctionGenerateModuleInit #! \see \ref MicroServices_AutoLoading #! function(usFunctionGenerateExecutableInit src_var) cmake_parse_arguments(US_EXECUTABLE "" "IDENTIFIER" "" ${ARGN}) # sanity checks if(NOT US_EXECUTABLE_IDENTIFIER) message(SEND_ERROR "IDENTIFIER argument is mandatory") endif() set(_regex_validation "[a-zA-Z_-][a-zA-Z_0-9-]*") string(REGEX MATCH ${_regex_validation} _valid_chars ${US_EXECUTABLE_IDENTIFIER}) if(NOT _valid_chars STREQUAL US_EXECUTABLE_IDENTIFIER) message(FATAL_ERROR "IDENTIFIER contains illegal characters.") endif() set(exec_init_src_file "${CMAKE_CURRENT_BINARY_DIR}/${US_EXECUTABLE_IDENTIFIER}_init.cpp") configure_file(${CppMicroServices_EXECUTABLE_INIT_TEMPLATE} ${exec_init_src_file} @ONLY) - set(_src ${${src_var}} ${exec_init_src_file}) + set(_src ${exec_init_src_file} ${${src_var}}) set(${src_var} ${_src} PARENT_SCOPE) endfunction() diff --git a/Core/CppMicroServices/CMake/usFunctionGenerateModuleInit.cmake b/Core/CppMicroServices/CMake/usFunctionGenerateModuleInit.cmake index e02cb839cb..7c330f87cd 100644 --- a/Core/CppMicroServices/CMake/usFunctionGenerateModuleInit.cmake +++ b/Core/CppMicroServices/CMake/usFunctionGenerateModuleInit.cmake @@ -1,54 +1,54 @@ #! \ingroup MicroServicesCMake #! \brief Generate a source file which handles proper initialization of a module. #! #! This CMake function will store the path to a generated source file in the #! src_var variable, which should be compiled into a module. Example usage: #! #! \code{.cmake} #! set(module_srcs ) #! usFunctionGenerateModuleInit(module_srcs #! NAME "My Module" #! LIBRARY_NAME "mylib" #! ) #! add_library(mylib ${module_srcs}) #! \endcode #! #! \param src_var (required) The name of a list variable to which the path of the generated #! source file will be appended. #! \param NAME (required) A human-readable name for the module. #! \param LIBRARY_NAME (optional) The name of the module, without extension. If empty, the #! NAME argument will be used. #! #! \see #usFunctionGenerateExecutableInit #! \see \ref MicroServices_AutoLoading #! function(usFunctionGenerateModuleInit src_var) cmake_parse_arguments(US_MODULE "EXECUTABLE" "NAME;LIBRARY_NAME" "" ${ARGN}) if(US_MODULE_EXECUTABLE) message(SEND_ERROR "EXECUTABLE option no longer supported. Use usFunctionGenerateExecutableInit instead.") endif() # sanity checks if(NOT US_MODULE_NAME) message(SEND_ERROR "NAME argument is mandatory") endif() if(NOT US_MODULE_LIBRARY_NAME) set(US_MODULE_LIBRARY_NAME ${US_MODULE_NAME}) endif() set(_regex_validation "[a-zA-Z_-][a-zA-Z_0-9-]*") string(REGEX MATCH ${_regex_validation} _valid_chars ${US_MODULE_LIBRARY_NAME}) if(NOT _valid_chars STREQUAL US_MODULE_LIBRARY_NAME) message(FATAL_ERROR "[Module: ${US_MODULE_NAME}] LIBRARY_NAME \"${US_MODULE_LIBRARY_NAME}\" contains illegal characters.") endif() set(module_init_src_file "${CMAKE_CURRENT_BINARY_DIR}/${US_MODULE_LIBRARY_NAME}_init.cpp") configure_file(${CppMicroServices_MODULE_INIT_TEMPLATE} ${module_init_src_file} @ONLY) - set(_src ${${src_var}} ${module_init_src_file}) + set(_src ${module_init_src_file} ${${src_var}}) set(${src_var} ${_src} PARENT_SCOPE) endfunction()