summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt
blob: f5336dc039df9c733eee21a630e28c47a576cef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cmake_minimum_required (VERSION 2.8)
project(CheckLanguage NONE)
include(CheckLanguage)

set(langs )
set(expect_C 1)
set(expect_CXX 1)
unset(expect_Fortran)
set(expect_NoSuchLanguage 0)
foreach(lang C CXX Fortran NoSuchLanguage)
  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()