summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-11-07 15:26:25 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-11-07 15:26:49 (GMT)
commit02ed66c04bf24d4c13fb6f82d040b835c966bf0c (patch)
tree8b73019ebf64ac87e9c41b49835708c2103e3ade
parent0746a3398f4e22f80c19b6253c4df652f9c41214 (diff)
parent7ddf46230431cd3375f911d4b406af663595861d (diff)
downloadCMake-02ed66c04bf24d4c13fb6f82d040b835c966bf0c.zip
CMake-02ed66c04bf24d4c13fb6f82d040b835c966bf0c.tar.gz
CMake-02ed66c04bf24d4c13fb6f82d040b835c966bf0c.tar.bz2
Merge topic 'unity-include-generated' into release-3.16
7ddf462304 Unity build: Include GENERATED files into unity build Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Julien Schueller <schueller@phimeca.com> Merge-request: !4001
-rw-r--r--Help/prop_tgt/UNITY_BUILD.rst5
-rw-r--r--Source/cmLocalGenerator.cxx1
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake6
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_skip.cmake5
4 files changed, 6 insertions, 11 deletions
diff --git a/Help/prop_tgt/UNITY_BUILD.rst b/Help/prop_tgt/UNITY_BUILD.rst
index 2faad92..fab4f15 100644
--- a/Help/prop_tgt/UNITY_BUILD.rst
+++ b/Help/prop_tgt/UNITY_BUILD.rst
@@ -40,9 +40,8 @@ Since multiple source files are included into one source file,
it can lead to ODR errors. This section contains properties
which help fixing these errors.
-The source files marked by :prop_sf:`GENERATED` will be skipped
-from unity build. This applies also for the source files marked
-with :prop_sf:`SKIP_UNITY_BUILD_INCLUSION`.
+The source files marked by :prop_sf:`SKIP_UNITY_BUILD_INCLUSION`
+will be skipped from unity build.
The source files that have :prop_sf:`COMPILE_OPTIONS`,
:prop_sf:`COMPILE_DEFINITIONS`, :prop_sf:`COMPILE_FLAGS`, or
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 00bd8af..cae47e0 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2441,7 +2441,6 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
std::back_inserter(filtered_sources), [&](cmSourceFile* sf) {
return sf->GetLanguage() == lang &&
!sf->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION") &&
- !sf->GetPropertyAsBool("GENERATED") &&
!sf->GetProperty("COMPILE_OPTIONS") &&
!sf->GetProperty("COMPILE_DEFINITIONS") &&
!sf->GetProperty("COMPILE_FLAGS") &&
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake
index fdd45bc..61419d8 100644
--- a/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake
+++ b/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake
@@ -1,9 +1,9 @@
set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0.c")
file(STRINGS ${unitybuild_c} unitybuild_c_strings)
-string(REGEX MATCH "\\/s[1-6].c" matched_files_1_6 ${unitybuild_c_strings})
-if(matched_files_1_6)
- set(RunCMake_TEST_FAILED "Generated unity contains s1.c -> s6.c which should have been skipped")
+string(REGEX MATCH "\\/s[2-6].c" matched_files_2_6 ${unitybuild_c_strings})
+if(matched_files_2_6)
+ set(RunCMake_TEST_FAILED "Generated unity contains s2.c -> s6.c which should have been skipped")
return()
endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake b/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake
index 74524ad..eef8ccc 100644
--- a/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake
+++ b/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake
@@ -1,7 +1,7 @@
project(unitybuild_skip C)
set(srcs "")
-foreach(s RANGE 1 8)
+foreach(s RANGE 2 8)
set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
list(APPEND srcs "${src}")
@@ -11,9 +11,6 @@ add_library(tgt SHARED ${srcs})
set_target_properties(tgt PROPERTIES UNITY_BUILD ON)
-set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/s1.c
- PROPERTIES GENERATED ON)
-
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/s2.c
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)