mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Fix the condition added by commit fada8cbfd6 (CheckLanguage: Report
CMAKE_CUDA_HOST_COMPILER if needed for compilation, 2019-05-31,
v3.15.0-rc1~12^2) to activate CUDA-specific logic. The old condition
had worked in our test suite only by accident because the loop variable
used in the test happened to be the name and value that the old
condition used! Update the test to use a different name.
Fixes: #19013
34 lines
903 B
CMake
34 lines
903 B
CMake
cmake_minimum_required (VERSION 2.8)
|
|
project(CheckLanguage NONE)
|
|
include(CheckLanguage)
|
|
|
|
set(langs )
|
|
set(expect_C 1)
|
|
set(expect_CXX 1)
|
|
|
|
if(APPLE)
|
|
set(expect_OBJC 1)
|
|
set(expect_OBJCXX 1)
|
|
endif()
|
|
unset(expect_Fortran)
|
|
set(expect_NoSuchLanguage 0)
|
|
|
|
set(LANGUAGES C CXX Fortran CUDA NoSuchLanguage)
|
|
if(APPLE)
|
|
list(APPEND LANGUAGES OBJC OBJCXX)
|
|
endif()
|
|
|
|
foreach(test_lang ${LANGUAGES})
|
|
check_language(${test_lang})
|
|
if(NOT DEFINED CMAKE_${test_lang}_COMPILER)
|
|
message(FATAL_ERROR "check_language(${test_lang}) did not set result")
|
|
endif()
|
|
if(DEFINED expect_${test_lang})
|
|
if(expect_${test_lang} AND NOT CMAKE_${test_lang}_COMPILER)
|
|
message(FATAL_ERROR "check_language(${test_lang}) should not fail!")
|
|
elseif(NOT expect_${test_lang} AND CMAKE_${test_lang}_COMPILER)
|
|
message(FATAL_ERROR "check_language(${test_lang}) should not succeed!")
|
|
endif()
|
|
endif()
|
|
endforeach()
|