diff options
author | Brad King <brad.king@kitware.com> | 2022-05-26 17:05:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-26 17:22:58 (GMT) |
commit | 9019537670003d8d35b6d838c7b22a751b4119b2 (patch) | |
tree | 136e16ffb0f94cf56bd65e49fbbff97d690cce76 /Source | |
parent | d45b4f59a438477106fa3cf6919f6401cda57302 (diff) | |
download | CMake-9019537670003d8d35b6d838c7b22a751b4119b2.zip CMake-9019537670003d8d35b6d838c7b22a751b4119b2.tar.gz CMake-9019537670003d8d35b6d838c7b22a751b4119b2.tar.bz2 |
MSYS/MinGW Makfiles: Select the compiler occurring first in PATH
Extend the change from commit e01990999a (Ninja: On Windows, select the
compiler occurring first in PATH, 2020-04-17, v3.18.0-rc1~291^2) to
apply to the MSYS/MinGW Makefiles generators too. Drop the implied
`gcc` and `g++` default compilers. This allows MinGW/Clang environments
to work out of the box.
Inspired-by: Mehdi Chinoune <mehdi.chinoune@hotmail.com>
Fixes: #23542
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalMSYSMakefileGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmGlobalMinGWMakefileGenerator.cxx | 12 |
2 files changed, 0 insertions, 24 deletions
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index c8520b8..cb63110 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -51,24 +51,12 @@ void cmGlobalMSYSMakefileGenerator::EnableLanguage( locations.push_back(makeloc); locations.push_back("/mingw/bin"); locations.push_back("c:/mingw/bin"); - std::string tgcc = cmSystemTools::FindProgram("gcc", locations); - std::string gcc = "gcc.exe"; - if (!tgcc.empty()) { - gcc = tgcc; - } - std::string tgxx = cmSystemTools::FindProgram("g++", locations); - std::string gxx = "g++.exe"; - if (!tgxx.empty()) { - gxx = tgxx; - } std::string trc = cmSystemTools::FindProgram("windres", locations); std::string rc = "windres.exe"; if (!trc.empty()) { rc = trc; } mf->AddDefinition("MSYS", "1"); - mf->AddDefinition("CMAKE_GENERATOR_CC", gcc); - mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx); mf->AddDefinition("CMAKE_GENERATOR_RC", rc); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index 54d048d..781912f 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -29,23 +29,11 @@ void cmGlobalMinGWMakefileGenerator::EnableLanguage( locations.push_back(cmSystemTools::GetProgramPath(makeProgram)); locations.push_back("/mingw/bin"); locations.push_back("c:/mingw/bin"); - std::string tgcc = cmSystemTools::FindProgram("gcc", locations); - std::string gcc = "gcc.exe"; - if (!tgcc.empty()) { - gcc = tgcc; - } - std::string tgxx = cmSystemTools::FindProgram("g++", locations); - std::string gxx = "g++.exe"; - if (!tgxx.empty()) { - gxx = tgxx; - } std::string trc = cmSystemTools::FindProgram("windres", locations); std::string rc = "windres.exe"; if (!trc.empty()) { rc = trc; } - mf->AddDefinition("CMAKE_GENERATOR_CC", gcc); - mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx); mf->AddDefinition("CMAKE_GENERATOR_RC", rc); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } |