mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
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
27 lines
780 B
CMake
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)
|