summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-02 12:45:51 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-02 12:45:57 (GMT)
commit66a7d2e222c3b8247f42b9eab02dbe42597a9d42 (patch)
treee53f4449ed59443d4482d92d218d5e9da9b78527 /Source
parent50d2d438ccf2bb9d5c6cc701e9cd2be6949a5c97 (diff)
parentad41c9cd1161bb3d19bc1db8a20a7b7e87665f3a (diff)
downloadCMake-66a7d2e222c3b8247f42b9eab02dbe42597a9d42.zip
CMake-66a7d2e222c3b8247f42b9eab02dbe42597a9d42.tar.gz
CMake-66a7d2e222c3b8247f42b9eab02dbe42597a9d42.tar.bz2
Merge topic 'file-set-no-custom-targets' into release-3.23
ad41c9cd11 target_sources(): Prohibit FILE_SET on custom targets Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !7027
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;