You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
848 B

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(lang ${LANGUAGES})
check_language(${lang})
if(NOT DEFINED CMAKE_${lang}_COMPILER)
message(FATAL_ERROR "check_language(${lang}) did not set result")
endif()
if(DEFINED expect_${lang})
if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER)
message(FATAL_ERROR "check_language(${lang}) should not fail!")
elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER)
message(FATAL_ERROR "check_language(${lang}) should not succeed!")
endif()
endif()
endforeach()