Build: Remove scripts include directories from worldserver compilation command line, allowing compilation to happen in directories with longer path before encountering msbuild error MSB6002: The command-line for the “RC” task is too long

Signed-off-by: luis <[email protected]>
This commit is contained in:
Shauren
2026-02-22 18:31:29 -03:00
committed by luis
parent 45fe788c6d
commit 6b58f36323
2 changed files with 10 additions and 6 deletions
+8 -4
View File
@@ -16,13 +16,17 @@
# ${CMAKE_CURRENT_SOURCE_DIR}
# EXCLUDE
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform
# HEADER_VISIBILITY PRIVATE) # default is PUBLIC, this controls whether other targets that have this target as dependency will be able to access its headers
#
function(CollectAndAddSourceFiles target_name current_dir)
cmake_parse_arguments(PARSE_ARGV 2 arg "" "BASE_DIR" "EXCLUDE")
cmake_parse_arguments(PARSE_ARGV 2 arg "" "BASE_DIR;HEADER_VISIBILITY" "EXCLUDE")
if(NOT arg_BASE_DIR)
set(arg_BASE_DIR "${current_dir}")
endif()
if(NOT arg_HEADER_VISIBILITY)
set(arg_HEADER_VISIBILITY "PUBLIC")
endif()
list(FIND arg_EXCLUDE "${current_dir}" IS_EXCLUDED)
if(IS_EXCLUDED EQUAL -1)
cmake_path(RELATIVE_PATH current_dir BASE_DIRECTORY "${arg_BASE_DIR}" OUTPUT_VARIABLE fileset_name)
@@ -41,12 +45,12 @@ function(CollectAndAddSourceFiles target_name current_dir)
${current_dir}/*.hpp)
target_sources(${target_name} PRIVATE ${private_source_files})
target_sources(${target_name} PUBLIC FILE_SET "headers_${fileset_name}" TYPE HEADERS BASE_DIRS ${current_dir} FILES ${public_header_files})
target_sources(${target_name} ${arg_HEADER_VISIBILITY} FILE_SET "headers_${fileset_name}" TYPE HEADERS BASE_DIRS ${current_dir} FILES ${public_header_files})
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
if(IS_DIRECTORY ${SUB_DIRECTORY})
CollectAndAddSourceFiles("${target_name}" "${SUB_DIRECTORY}" BASE_DIR ${arg_BASE_DIR} EXCLUDE ${arg_EXCLUDE})
CollectAndAddSourceFiles("${target_name}" "${SUB_DIRECTORY}" BASE_DIR ${arg_BASE_DIR} HEADER_VISIBILITY ${arg_HEADER_VISIBILITY} EXCLUDE ${arg_EXCLUDE})
endif()
endforeach()
endif()