summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-11-28 12:50:15 (GMT)
committerBrad King <brad.king@kitware.com>2017-11-28 12:57:58 (GMT)
commitacb4cb950023be9300699a0220715bebb50306ad (patch)
tree0632a156bc8bdfa03d75d81b7fbda4019096bcb1 /Modules
parent65f21a7eadc2144f0c85cd883cf63a6eb7681528 (diff)
downloadCMake-acb4cb950023be9300699a0220715bebb50306ad.zip
CMake-acb4cb950023be9300699a0220715bebb50306ad.tar.gz
CMake-acb4cb950023be9300699a0220715bebb50306ad.tar.bz2
CMakeFindBinUtils: Improve switch between MSVC- and GNU-like tools
The switch was not considering some languages, such as `ASM`. Instead of memorizing the list of languages in the condition, use a language specified by the includer. Fixes: #17510
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake3
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineSwiftCompiler.cmake2
-rw-r--r--Modules/CMakeFindBinUtils.cmake13
7 files changed, 12 insertions, 14 deletions
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index f7cf54a..ed8f598 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -163,8 +163,8 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "ASM")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 4e56ce1..7e6ca1e 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -166,8 +166,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "C")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_C_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index c9cd7e2..f5a3ebd 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -73,7 +73,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
endif()
+set(_CMAKE_PROCESSING_LANGUAGE "CUDA")
include(CMakeFindBinUtils)
+unset(_CMAKE_PROCESSING_LANGUAGE)
+
if(MSVC_CUDA_ARCHITECTURE_ID)
set(SET_MSVC_CUDA_ARCHITECTURE_ID
"set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})")
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 4541844..c0fb3b6 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -164,8 +164,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "CXX")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_CXX_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 2549c22..cf502f6 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -258,8 +258,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "Fortran")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_Fortran_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake
index 2604906..dd02d54 100644
--- a/Modules/CMakeDetermineSwiftCompiler.cmake
+++ b/Modules/CMakeDetermineSwiftCompiler.cmake
@@ -34,7 +34,9 @@ if (NOT _CMAKE_TOOLCHAIN_LOCATION)
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH)
endif ()
+set(_CMAKE_PROCESSING_LANGUAGE "Swift")
include(CMakeFindBinUtils)
+unset(_CMAKE_PROCESSING_LANGUAGE)
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e4103d0..ece0547 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -20,16 +20,9 @@
# on UNIX, cygwin and mingw
# if it's the MS C/CXX compiler, search for link
-if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
- OR (CMAKE_HOST_WIN32 AND (
- "x${CMAKE_C_COMPILER_ID}" STREQUAL "xPGI"
- OR "x${CMAKE_Fortran_COMPILER_ID}" STREQUAL "xPGI"
- ))
+if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC"
+ OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xPGI")
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))