diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-05-06 19:45:42 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2020-05-07 15:13:34 (GMT) |
commit | 9f4eb352fe1383f740876e3924205be1d4bf897c (patch) | |
tree | 6911d23d9c5f950860a9ba1d0048b4d7f1417f1c /Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake | |
parent | b00585adcc11afcf4d02d9d9927a929f33b19546 (diff) | |
download | CMake-9f4eb352fe1383f740876e3924205be1d4bf897c.zip CMake-9f4eb352fe1383f740876e3924205be1d4bf897c.tar.gz CMake-9f4eb352fe1383f740876e3924205be1d4bf897c.tar.bz2 |
Unity Builds: Support explicit specification of sources to groups
Instead of having CMake determine which files should go into each
unity file, the user can now use explicitly state the mapping.
Diffstat (limited to 'Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake')
-rw-r--r-- | Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake new file mode 100644 index 0000000..9804289 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake @@ -0,0 +1,27 @@ +project(unitybuild_cxx CXX) + +set(srcs "") +foreach(s RANGE 1 4) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +foreach(s RANGE 1 2) + set(src "${CMAKE_CURRENT_BINARY_DIR}/odr${s}.cxx") + file(WRITE "${src}" "namespace odr { int s${s}(void) { return 0; } }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON + UNITY_BUILD_MODE GROUP + ) + +set_source_files_properties(s1.cxx s2.cxx odr1.cxx + PROPERTIES UNITY_GROUP "a" + ) +set_source_files_properties(s3.cxx s4.cxx odr2.cxx + PROPERTIES UNITY_GROUP "b" + ) |