From 466f9b886da1826243e222e946a48ba1428acf63 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sat, 3 Dec 2022 22:25:57 +1100 Subject: cmTargetPropCommandBase::HandleArguments: flags must be OR'able The flags argument is intended to support multiple flags from the ArgumentFlags enum. Therefore, flags cannot be of enum type, it must be an integral type that allows flags to be OR'ed together. Update the one call site that was erroneously OR'ing multiple values but then casting that to an ArgumentFlags, which could result in passing a technically invalid value. Amends: dd3482f6752d (cmTargetPropCommandBase: Restore ArgumentFlags enum value bool logic, 2022-11-27) --- Source/cmTargetIncludeDirectoriesCommand.cxx | 5 ++--- Source/cmTargetPropCommandBase.cxx | 2 +- Source/cmTargetPropCommandBase.h | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index cb83873..7a2dd09 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -100,8 +100,7 @@ bool cmTargetIncludeDirectoriesCommand(std::vector const& args, { return TargetIncludeDirectoriesImpl(status).HandleArguments( args, "INCLUDE_DIRECTORIES", - static_cast( - TargetIncludeDirectoriesImpl::PROCESS_BEFORE | + TargetIncludeDirectoriesImpl::PROCESS_BEFORE | TargetIncludeDirectoriesImpl::PROCESS_AFTER | - TargetIncludeDirectoriesImpl::PROCESS_SYSTEM)); + TargetIncludeDirectoriesImpl::PROCESS_SYSTEM); } diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 391b954..8d2ff71 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -23,7 +23,7 @@ void cmTargetPropCommandBase::SetError(std::string const& e) bool cmTargetPropCommandBase::HandleArguments( std::vector const& args, const std::string& prop, - ArgumentFlags flags) + unsigned int flags) { if (args.size() < 2) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h index 487beb4..ac50b4d 100644 --- a/Source/cmTargetPropCommandBase.h +++ b/Source/cmTargetPropCommandBase.h @@ -29,8 +29,7 @@ public: }; bool HandleArguments(std::vector const& args, - const std::string& prop, - ArgumentFlags flags = NO_FLAGS); + const std::string& prop, unsigned int flags = NO_FLAGS); protected: std::string Property; -- cgit v0.12