mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-13 12:59:55 -05:00
Merge topic 'mingw-compiler-PATH'
55ba10dcfdMSYS/MinGW Makefiles: Simplify selection of windres as Resource Compiler9019537670MSYS/MinGW Makfiles: Select the compiler occurring first in PATH Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: مهدي شينون (Mehdi Chinoune) <mehdi.chinoune@hotmail.com> Merge-request: !7301
This commit is contained in:
7
Help/release/dev/mingw-compiler-PATH.rst
Normal file
7
Help/release/dev/mingw-compiler-PATH.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
mingw-compiler-PATH
|
||||
-------------------
|
||||
|
||||
* The :generator:`MSYS Makefiles` and :generator:`MinGW Makefiles`
|
||||
generators, when a compiler is not explicitly specified, now select
|
||||
the first compiler (of any name) found in directories listed by the
|
||||
``PATH`` environment variable.
|
||||
@@ -53,10 +53,9 @@ macro(_cmake_find_compiler lang)
|
||||
NO_DEFAULT_PATH
|
||||
DOC "${lang} compiler")
|
||||
endif()
|
||||
if(CMAKE_HOST_WIN32 AND CMAKE_GENERATOR MATCHES "Ninja")
|
||||
# On Windows command-line builds, the Makefile generators each imply
|
||||
# a preferred compiler tool. The Ninja generator does not imply a
|
||||
# compiler tool, so use the compiler that occurs first in PATH.
|
||||
if(CMAKE_HOST_WIN32 AND CMAKE_GENERATOR MATCHES "Ninja|MSYS Makefiles|MinGW Makefiles")
|
||||
# On Windows command-line builds, some generators imply a preferred compiler tool.
|
||||
# These generators do not, so use the compiler that occurs first in PATH.
|
||||
find_program(CMAKE_${lang}_COMPILER
|
||||
NAMES ${CMAKE_${lang}_COMPILER_LIST}
|
||||
NAMES_PER_DIR
|
||||
|
||||
@@ -42,34 +42,7 @@ std::string cmGlobalMSYSMakefileGenerator::FindMinGW(
|
||||
void cmGlobalMSYSMakefileGenerator::EnableLanguage(
|
||||
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
|
||||
{
|
||||
this->FindMakeProgram(mf);
|
||||
const std::string& makeProgram =
|
||||
mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
||||
std::vector<std::string> locations;
|
||||
std::string makeloc = cmSystemTools::GetProgramPath(makeProgram);
|
||||
locations.push_back(this->FindMinGW(makeloc));
|
||||
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);
|
||||
|
||||
if (!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile() &&
|
||||
|
||||
@@ -19,37 +19,6 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
|
||||
cm->GetState()->SetMinGWMake(true);
|
||||
}
|
||||
|
||||
void cmGlobalMinGWMakefileGenerator::EnableLanguage(
|
||||
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
|
||||
{
|
||||
this->FindMakeProgram(mf);
|
||||
const std::string& makeProgram =
|
||||
mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
||||
std::vector<std::string> locations;
|
||||
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);
|
||||
}
|
||||
|
||||
void cmGlobalMinGWMakefileGenerator::GetDocumentation(
|
||||
cmDocumentationEntry& entry)
|
||||
{
|
||||
|
||||
@@ -36,11 +36,4 @@ public:
|
||||
|
||||
/** Get the documentation entry for this generator. */
|
||||
static void GetDocumentation(cmDocumentationEntry& entry);
|
||||
|
||||
/**
|
||||
* Try to determine system information such as shared library
|
||||
* extension, pthreads, byte order etc.
|
||||
*/
|
||||
virtual void EnableLanguage(std::vector<std::string> const& languages,
|
||||
cmMakefile*, bool optional);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user