Files
cmake/Tests/RunCMake/FASTBuild/UnitySubdirsIsolate-check.cmake
T
Andrew Maher 3f43795df9 FASTBuild: Allow files in different subdirs to be in the same unity bucket
The FASTBuild generator puts source files from different subdirectories
into different `FastbuildObjectListNode` instances. This ensures that
files with the same name will not write to the same object file. A unity
bucket can only contain files from a single `FastbuildObjectListNode`
instance, so a side effect of this logic is that unity buckets can only
contain files in the same subdirectory. This change fixes the problem by
skipping the subdirectory check logic for files with unity enabled.

Fixes: #27457
2026-02-11 14:38:22 -05:00

27 lines
780 B
CMake

# Verify that:
# 1. Non-isolated files from different subdirs are combined in one Unity node
# 2. Isolated files from subdirs are in separate ObjectLists with proper subdir paths
# Check that Unity node contains the non-isolated files (main.cpp and unity_file.cpp)
# but not the isolated file. The isolated file should be compiled separately with
# its subdirectory in the output path.
set(REGEX_TO_MATCH "
Unity\\('main_Unity_1'\\)
{
\\.UnityOutputPath = 'CMakeFiles/main.dir'
\\.UnityOutputPattern = 'main_Unity_1.cpp'
\\.UnityInputFiles =
{
.*main.cpp',
.*subdir1/unity_file.cpp'
}
}
.*ObjectList.*
.*
\\.CompilerOutputPath = 'CMakeFiles/main.dir/subdir2'
.*
.*isolated_file.cpp'
")
include(${RunCMake_SOURCE_DIR}/check.cmake)