CheckFortranCompilerFlag.cmake 482 B

12345678910111213141516
  1. enable_language (Fortran)
  2. include(CheckCompilerFlag)
  3. set(Fortran 1) # test that this is tolerated
  4. check_compiler_flag(Fortran "-_this_is_not_a_flag_" SHOULD_FAIL)
  5. if(SHOULD_FAIL)
  6. message(SEND_ERROR "invalid Fortran compile flag didn't fail.")
  7. endif()
  8. if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
  9. check_compiler_flag(Fortran "-Wall" SHOULD_WORK)
  10. if(NOT SHOULD_WORK)
  11. message(SEND_ERROR "${CMAKE_Fortran_COMPILER_ID} compiler flag '-Wall' check failed")
  12. endif()
  13. endif()