diff options
author | Brad King <brad.king@kitware.com> | 2020-04-23 13:13:43 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-23 13:13:56 (GMT) |
commit | b779cb13b4462ad3245a442bb7c8fcd70e3faac6 (patch) | |
tree | 7bcf7fbe2d8774f3fa5f3c33cbb824ca6cccc605 /Modules | |
parent | d2ab8c522699d0465258dfc991b47849aa830f62 (diff) | |
parent | e01990999a83fb08b0e46b3131501c01e3256944 (diff) | |
download | CMake-b779cb13b4462ad3245a442bb7c8fcd70e3faac6.zip CMake-b779cb13b4462ad3245a442bb7c8fcd70e3faac6.tar.gz CMake-b779cb13b4462ad3245a442bb7c8fcd70e3faac6.tar.bz2 |
Merge topic 'ninja-compiler-PATH-windows'
e01990999a Ninja: On Windows, select the compiler occurring first in PATH
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4625
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompiler.cmake | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index 7afae8a..da93b5c 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -53,6 +53,20 @@ 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. + find_program(CMAKE_${lang}_COMPILER + NAMES ${CMAKE_${lang}_COMPILER_LIST} + NAMES_PER_DIR + DOC "${lang} compiler" + NO_PACKAGE_ROOT_PATH + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + ) + endif() find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler") if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER) set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}") |