mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-16 20:21:41 -06:00
Toolchain: Handle repeated invocations of CMake with -DCMAKE_C_COMPILER
Repeated invocations of `cmake ... -DCMAKE_C_COMPILER=gcc` should not trigger a "You have changed variables" message even though the cache value of CMAKE_C_COMPILER changes from '/path/to/gcc' to 'gcc'. Make repeated invocations of `cmake ... -DCMAKE_C_COMPILER=gcc;-pipe` not trigger the warning by comparing the compiler name portion of the list to the compiler being used.
This commit is contained in:
@@ -235,6 +235,14 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
|
|||||||
}
|
}
|
||||||
cmProp cname =
|
cmProp cname =
|
||||||
this->GetCMakeInstance()->GetState()->GetInitializedCacheValue(langComp);
|
this->GetCMakeInstance()->GetState()->GetInitializedCacheValue(langComp);
|
||||||
|
|
||||||
|
// Split compiler from arguments
|
||||||
|
std::vector<std::string> cnameArgVec;
|
||||||
|
if (cname && !cname->empty()) {
|
||||||
|
cmExpandList(*cname, cnameArgVec);
|
||||||
|
cname = &cnameArgVec.front();
|
||||||
|
}
|
||||||
|
|
||||||
std::string changeVars;
|
std::string changeVars;
|
||||||
if (cname && !optional) {
|
if (cname && !optional) {
|
||||||
std::string cnameString;
|
std::string cnameString;
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
|
|||||||
this->VariableMappings["CMAKE_" + compIt->second +
|
this->VariableMappings["CMAKE_" + compIt->second +
|
||||||
"_COMPILE_OPTIONS_SYSROOT"];
|
"_COMPILE_OPTIONS_SYSROOT"];
|
||||||
|
|
||||||
// if there is a required first argument to the compiler add it
|
// if there are required arguments to the compiler add it
|
||||||
// to the compiler string
|
// to the compiler string
|
||||||
if (!compilerArg1.empty()) {
|
if (!compilerArg1.empty()) {
|
||||||
ret += " ";
|
ret += " ";
|
||||||
|
|||||||
Reference in New Issue
Block a user