236f37b5443d99e0888602680c638ce7c8c11063
[platform/upstream/cmake.git] / Tests / RunCMake / CheckCompilerFlag / CheckFortranCompilerFlag.cmake
1 enable_language (Fortran)
2 include(CheckCompilerFlag)
3
4 set(Fortran 1) # test that this is tolerated
5
6 check_compiler_flag(Fortran "-_this_is_not_a_flag_" SHOULD_FAIL)
7 if(SHOULD_FAIL)
8   message(SEND_ERROR "invalid Fortran compile flag didn't fail.")
9 endif()
10
11 if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU|LCC")
12   check_compiler_flag(Fortran "-Wall" SHOULD_WORK)
13   if(NOT SHOULD_WORK)
14     message(SEND_ERROR "${CMAKE_Fortran_COMPILER_ID} compiler flag '-Wall' check failed")
15   endif()
16 endif()