summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-18 16:20:42 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-05-18 16:20:50 (GMT)
commitca699e9d69a68e6c0f9ab7f7a76930c9295c1f59 (patch)
tree46a36390779ee8c33f38538e945475cde1197d91
parent6d9bc2d8cf41d651a6e8c9f6e3e6f5ab384d1f6a (diff)
parent25995b2b3028a5f990792b6e2e409f681c3a89d0 (diff)
downloadCMake-ca699e9d69a68e6c0f9ab7f7a76930c9295c1f59.zip
CMake-ca699e9d69a68e6c0f9ab7f7a76930c9295c1f59.tar.gz
CMake-ca699e9d69a68e6c0f9ab7f7a76930c9295c1f59.tar.bz2
Merge topic 'fix-CheckTargetsForMissingSources'
25995b2b30 cmGlobalGenerator: Fix CheckTargetsForMissingSources after refactoring Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4747
-rw-r--r--Source/cmGlobalGenerator.cxx2
-rw-r--r--Tests/ConfigSources/CMakeLists.txt14
2 files changed, 15 insertions, 1 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6370ed2..cfad4c2 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -320,7 +320,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
} else {
for (std::string const& config : configs) {
target->GetSourceFiles(srcs, config);
- if (srcs.empty()) {
+ if (!srcs.empty()) {
break;
}
}
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt
index 21f923e..c5f9c50 100644
--- a/Tests/ConfigSources/CMakeLists.txt
+++ b/Tests/ConfigSources/CMakeLists.txt
@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.0)
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build")
+endif()
project(ConfigSources CXX)
# Per-config sources via INTERFACE_SOURCES.
@@ -55,3 +59,13 @@ target_compile_definitions(ConfigSourcesLinkIface PRIVATE
"$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
)
target_link_libraries(ConfigSourcesLinkIface ConfigSourcesIface)
+
+# A target with sources in only one configuration that is not the
+# first in CMAKE_CONFIGURATION_TYPES.
+if(CMAKE_CONFIGURATION_TYPES MATCHES ";([^;]+)")
+ set(one_config "${CMAKE_MATCH_1}")
+else()
+ set(one_config "${CMAKE_BUILD_TYPE}")
+endif()
+add_library(OneConfigOnly OBJECT "$<$<CONFIG:${one_config}>:${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp>")
+set_property(TARGET OneConfigOnly PROPERTY LINKER_LANGUAGE CXX)