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()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(TetraIF)
|
# Respect MIGRATE_MODULE: when set to a relative path (e.g. "Lts/Common"), only add
|
||||||
ADD_SUBDIRECTORY(Z/src)
|
# the top-level subdirectories required to configure/build that module. This allows
|
||||||
ADD_SUBDIRECTORY(Lts)
|
# 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
|
# 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