mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
feat(Cmake/Modules): support add config all modules without AC_ADD_CONFIG_FILE (#5994)
This commit is contained in:
@@ -57,6 +57,5 @@ ENDMACRO()
|
||||
#AC_ADD_CONFIG_FILE
|
||||
#
|
||||
MACRO(AC_ADD_CONFIG_FILE configFilePath)
|
||||
CU_GET_GLOBAL("MODULE_CONFIG_FILE_LIST")
|
||||
CU_ADD_GLOBAL("MODULE_CONFIG_FILE_LIST" "${configFilePath}")
|
||||
message("> Warning: module using deprecated add config file api")
|
||||
ENDMACRO()
|
||||
|
||||
@@ -68,23 +68,34 @@ function(CopyModuleConfig configDir)
|
||||
unset(postPath)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Use it like:
|
||||
# CollectModulesConfig()
|
||||
#
|
||||
# Stores the absolut path of the given config module in the variable
|
||||
function(GetPathToModuleConfig module variable)
|
||||
set(${variable} "${CMAKE_SOURCE_DIR}/modules/${module}/conf" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Creates a list of all configs modules
|
||||
# and stores it in the given variable.
|
||||
function(CollectModulesConfig)
|
||||
file(GLOB LOCALE_MODULE_LIST RELATIVE
|
||||
${CMAKE_SOURCE_DIR}/modules
|
||||
${CMAKE_SOURCE_DIR}/modules/*)
|
||||
|
||||
message(STATUS "* Modules config list:")
|
||||
|
||||
CU_GET_GLOBAL("MODULE_CONFIG_FILE_LIST")
|
||||
foreach(CONFIG_MODULE ${LOCALE_MODULE_LIST})
|
||||
GetPathToModuleConfig(${CONFIG_MODULE} MODULE_CONFIG_PATH)
|
||||
|
||||
file(GLOB MODULE_CONFIG_LIST RELATIVE
|
||||
${MODULE_CONFIG_PATH}
|
||||
${MODULE_CONFIG_PATH}/*.conf.dist)
|
||||
|
||||
foreach(configFileName ${MODULE_CONFIG_LIST})
|
||||
CopyModuleConfig("${MODULE_CONFIG_PATH}/${configFileName}")
|
||||
set(CONFIG_LIST ${CONFIG_LIST}${configFileName},)
|
||||
message(STATUS " |- ${configFileName}")
|
||||
endforeach()
|
||||
|
||||
foreach(configFile ${MODULE_CONFIG_FILE_LIST})
|
||||
CopyModuleConfig(${configFile})
|
||||
get_filename_component(file_name ${configFile} NAME)
|
||||
set(CONFIG_LIST ${CONFIG_LIST}${file_name},)
|
||||
message(STATUS " |- ${file_name}")
|
||||
endforeach()
|
||||
|
||||
message("")
|
||||
add_definitions(-DCONFIG_FILE_LIST=$<1:"${CONFIG_LIST}">)
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user