summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-02-28 22:11:53 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-02-28 22:21:04 (GMT)
commitad41c9cd1161bb3d19bc1db8a20a7b7e87665f3a (patch)
tree5565417c0cce39155f0fe48076da98fe21247cee /Source
parent07a7772968a17e804fc7c450a0a3a00a7203410d (diff)
downloadCMake-ad41c9cd1161bb3d19bc1db8a20a7b7e87665f3a.zip
CMake-ad41c9cd1161bb3d19bc1db8a20a7b7e87665f3a.tar.gz
CMake-ad41c9cd1161bb3d19bc1db8a20a7b7e87665f3a.tar.bz2
target_sources(): Prohibit FILE_SET on custom targets
Fixes: #23262
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTargetSourcesCommand.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 818e271..b425acb 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -16,6 +16,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -202,6 +203,11 @@ bool TargetSourcesImpl::HandleFileSetMode(
return false;
}
+ if (this->Target->GetType() == cmStateEnums::UTILITY) {
+ this->SetError("FILE_SETs may not be added to custom targets");
+ return false;
+ }
+
bool const isDefault = args.Type == args.FileSet ||
(args.Type.empty() && args.FileSet[0] >= 'A' && args.FileSet[0] <= 'Z');
std::string type = isDefault ? args.FileSet : args.Type;