chore(cmake): honor -DMIGRATE_MODULE to add only necessary subdirectories for per-module migration builds\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
1c6e1fa8b3
commit
5a74df95f2
1 file changed
+28
-4
+28
-4
@@ -326,11 +326,35 @@ if(NOT RTI_FOUND)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
ADD_SUBDIRECTORY(TetraIF)
|
||||
ADD_SUBDIRECTORY(Z/src)
|
||||
ADD_SUBDIRECTORY(Lts)
|
||||
# Respect MIGRATE_MODULE: when set to a relative path (e.g. "Lts/Common"), only add
|
||||
# the top-level subdirectories required to configure/build that module. This allows
|
||||
# per-module migration builds via -DMIGRATE_MODULE=<path>.
|
||||
if(NOT DEFINED MIGRATE_MODULE)
|
||||
set(MIGRATE_MODULE "" CACHE STRING "If set, only add subdirectories covering this module (path relative to repo root)")
|
||||
endif()
|
||||
|
||||
function(NGL_ADD_SUBDIR_GUARDED subdir)
|
||||
if(MIGRATE_MODULE STREQUAL "")
|
||||
add_subdirectory(${subdir})
|
||||
else()
|
||||
# normalize to forward slashes
|
||||
string(REPLACE "\\" "/" _mig "${MIGRATE_MODULE}")
|
||||
string(REPLACE "\\" "/" _sub "${subdir}")
|
||||
if(_mig MATCHES "^${_sub}(/|$)" OR _sub MATCHES "^${_mig}(/|$)")
|
||||
message(STATUS "Including subdir ${subdir} because MIGRATE_MODULE=${MIGRATE_MODULE}")
|
||||
add_subdirectory(${subdir})
|
||||
else()
|
||||
message(STATUS "Skipping subdir ${subdir} because MIGRATE_MODULE=${MIGRATE_MODULE}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Add only guarded subdirectories
|
||||
NGL_ADD_SUBDIR_GUARDED(TetraIF)
|
||||
NGL_ADD_SUBDIR_GUARDED(Z/src)
|
||||
NGL_ADD_SUBDIR_GUARDED(Lts)
|
||||
# at last, to make sure we get all targets in NGL_TS_TARGETS property
|
||||
ADD_SUBDIRECTORY(translations)
|
||||
NGL_ADD_SUBDIR_GUARDED(translations)
|
||||
#-----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user