Test variables CMAKE_(C|CXX|Fortran)_COMPILER(|_ID|_VERSION)

Add tests CMakeOnly.CompilerId(C|CXX|Fortran) to check that the basic
compiler tool path, vendor, and version variables have been set as
expected.
This commit is contained in:
Brad King 2012-08-21 13:30:50 -04:00
parent ec22a9b521
commit 8be51f6694
4 changed files with 56 additions and 0 deletions

View File

@ -19,6 +19,12 @@ add_CMakeOnly_test(CheckCXXCompilerFlag)
add_CMakeOnly_test(CheckLanguage)
add_CMakeOnly_test(CompilerIdC)
add_CMakeOnly_test(CompilerIdCXX)
if(CMAKE_Fortran_COMPILER)
add_CMakeOnly_test(CompilerIdFortran)
endif()
add_CMakeOnly_test(AllFindModules)
add_CMakeOnly_test(TargetScope)

View File

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8.9)
project(CompilerIdC C)
foreach(v
CMAKE_C_COMPILER
CMAKE_C_COMPILER_ID
CMAKE_C_COMPILER_VERSION
)
if(${v})
message(STATUS "${v}=[${${v}}]")
else()
message(SEND_ERROR "${v} not set!")
endif()
endforeach()

View File

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8.9)
project(CompilerIdCXX CXX)
foreach(v
CMAKE_CXX_COMPILER
CMAKE_CXX_COMPILER_ID
CMAKE_CXX_COMPILER_VERSION
)
if(${v})
message(STATUS "${v}=[${${v}}]")
else()
message(SEND_ERROR "${v} not set!")
endif()
endforeach()

View File

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 2.8.9)
project(CompilerIdFortran Fortran)
foreach(v
CMAKE_Fortran_COMPILER
CMAKE_Fortran_COMPILER_ID
)
if(${v})
message(STATUS "${v}=[${${v}}]")
else()
message(SEND_ERROR "${v} not set!")
endif()
endforeach()
foreach(v
CMAKE_Fortran_COMPILER_VERSION
)
if(${v})
message(STATUS "${v}=[${${v}}]")
else()
message(WARNING "${v} not set!")
endif()
endforeach()