diff options
author | Brad King <brad.king@kitware.com> | 2022-05-26 13:05:38 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-26 13:22:58 -0400 |
commit | 9019537670003d8d35b6d838c7b22a751b4119b2 (patch) | |
tree | 136e16ffb0f94cf56bd65e49fbbff97d690cce76 /Modules/CMakeDetermineCompiler.cmake | |
parent | d45b4f59a438477106fa3cf6919f6401cda57302 (diff) | |
download | cmake-9019537670003d8d35b6d838c7b22a751b4119b2.tar.gz |
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 'Modules/CMakeDetermineCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompiler.cmake | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index ec2a86515f..3156ca9044 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -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 |