diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmCommands.cxx | 14 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 17 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 5 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 17 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmState.cxx | 9 | ||||
-rw-r--r-- | Source/cmState.h | 2 |
8 files changed, 49 insertions, 19 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ca070e9..46e94f1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 20) -set(CMake_VERSION_PATCH 20210616) +set(CMake_VERSION_PATCH 20210617) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 9e5b783..a241a3a 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -164,36 +164,36 @@ void GetScriptingCommands(cmState* state) state->AddBuiltinCommand("string", cmStringCommand); state->AddBuiltinCommand("unset", cmUnsetCommand); - state->AddUnexpectedCommand( + state->AddUnexpectedFlowControlCommand( "else", "An ELSE command was found outside of a proper " "IF ENDIF structure. Or its arguments did not match " "the opening IF command."); - state->AddUnexpectedCommand( + state->AddUnexpectedFlowControlCommand( "elseif", "An ELSEIF command was found outside of a proper " "IF ENDIF structure."); - state->AddUnexpectedCommand( + state->AddUnexpectedFlowControlCommand( "endforeach", "An ENDFOREACH command was found outside of a proper " "FOREACH ENDFOREACH structure. Or its arguments did " "not match the opening FOREACH command."); - state->AddUnexpectedCommand( + state->AddUnexpectedFlowControlCommand( "endfunction", "An ENDFUNCTION command was found outside of a proper " "FUNCTION ENDFUNCTION structure. Or its arguments did not " "match the opening FUNCTION command."); - state->AddUnexpectedCommand( + state->AddUnexpectedFlowControlCommand( "endif", "An ENDIF command was found outside of a proper " "IF ENDIF structure. Or its arguments did not match " "the opening IF command."); - state->AddUnexpectedCommand( + state->AddUnexpectedFlowControlCommand( "endmacro", "An ENDMACRO command was found outside of a proper " "MACRO ENDMACRO structure. Or its arguments did not " "match the opening MACRO command."); - state->AddUnexpectedCommand( + state->AddUnexpectedFlowControlCommand( "endwhile", "An ENDWHILE command was found outside of a proper " "WHILE ENDWHILE structure. Or its arguments did not " diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 6c52ce0..fa51092 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1359,8 +1359,12 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry, return value; } -static cmIDEFlagTable const* cmLoadFlagTableJson( - std::string const& flagJsonPath) +namespace { + +unsigned long long const vsVer16_10_0 = 4503644629696790; + +cmIDEFlagTable const* cmLoadFlagTableJson( + std::string const& flagJsonPath, cm::optional<unsigned long long> vsver) { cmIDEFlagTable* ret = nullptr; auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath); @@ -1382,6 +1386,11 @@ static cmIDEFlagTable const* cmLoadFlagTableJson( flagEntry.comment = cmLoadFlagTableString(flag, "comment"); flagEntry.value = cmLoadFlagTableString(flag, "value"); flagEntry.special = cmLoadFlagTableSpecial(flag, "flags"); + // FIXME: Port this version check to a Json field. + if (vsver && *vsver < vsVer16_10_0 && + flagEntry.IDEName == "ExternalWarningLevel") { + continue; + } flagTable.push_back(flagEntry); } cmIDEFlagTable endFlag{ "", "", "", "", 0 }; @@ -1394,6 +1403,7 @@ static cmIDEFlagTable const* cmLoadFlagTableJson( } return ret; } +} cm::optional<std::string> cmGlobalVisualStudio10Generator::FindFlagTable( cm::string_view toolsetName, cm::string_view table) const @@ -1456,7 +1466,8 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable( } } - if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename)) { + cm::optional<unsigned long long> vsver = this->GetVSInstanceVersion(); + if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename, vsver)) { return ret; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 2596720..48fe465 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -128,6 +128,11 @@ public: std::string Encoding() override; const char* GetToolsVersion() const; + virtual cm::optional<unsigned long long> GetVSInstanceVersion() const + { + return {}; + } + bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; } bool FindMakeProgram(cmMakefile* mf) override; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index c11ab1b..50dc30b 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -391,10 +391,15 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance( return vsSetupAPIHelper.GetVSInstanceInfo(dir); } -bool cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion( - unsigned long long& vsInstanceVersion) const +cm::optional<unsigned long long> +cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion() const { - return vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion); + cm::optional<unsigned long long> result; + unsigned long long vsInstanceVersion; + if (vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion)) { + result = vsInstanceVersion; + } + return result; } bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const @@ -407,9 +412,9 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const return false; } unsigned long long const vsInstanceVersion16_7_P2 = 4503631666610212; - unsigned long long vsInstanceVersion; - return (this->GetVSInstanceVersion(vsInstanceVersion) && - vsInstanceVersion > vsInstanceVersion16_7_P2); + cm::optional<unsigned long long> vsInstanceVersion = + this->GetVSInstanceVersion(); + return (vsInstanceVersion && *vsInstanceVersion > vsInstanceVersion16_7_P2); } const char* diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index cee129e..105e495 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -28,7 +28,7 @@ public: bool GetVSInstance(std::string& dir) const; - bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion) const; + cm::optional<unsigned long long> GetVSInstanceVersion() const override; AuxToolset FindAuxToolset(std::string& version, std::string& props) const override; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 0b8a64b..ce6eb31 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -481,7 +481,7 @@ void cmState::AddDisallowedCommand(std::string const& name, void cmState::AddUnexpectedCommand(std::string const& name, const char* error) { - this->AddFlowControlCommand( + this->AddBuiltinCommand( name, [name, error](std::vector<cmListFileArgument> const&, cmExecutionStatus& status) -> bool { @@ -496,6 +496,13 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error) }); } +void cmState::AddUnexpectedFlowControlCommand(std::string const& name, + const char* error) +{ + this->FlowControlCommands.insert(name); + this->AddUnexpectedCommand(name, error); +} + bool cmState::AddScriptedCommand(std::string const& name, BT<Command> command, cmMakefile& mf) { diff --git a/Source/cmState.h b/Source/cmState.h index 4e41156..9951b9a 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -166,6 +166,8 @@ public: void AddDisallowedCommand(std::string const& name, BuiltinCommand command, cmPolicies::PolicyID policy, const char* message); void AddUnexpectedCommand(std::string const& name, const char* error); + void AddUnexpectedFlowControlCommand(std::string const& name, + const char* error); bool AddScriptedCommand(std::string const& name, BT<Command> command, cmMakefile& mf); void RemoveBuiltinCommand(std::string const& name); |