CMakeLists.txt 967 B

12345678910111213141516171819202122232425
  1. cmake_minimum_required(VERSION 2.8)
  2. project(FortranC C Fortran)
  3. # Skip this test for compilers not known to be compatible.
  4. if(NOT (CMAKE_C_COMPILER_ID STREQUAL CMAKE_Fortran_COMPILER_ID OR
  5. "${CMAKE_C_COMPILER_ID}-${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(MSVC-Intel)$"))
  6. message(STATUS "${CMAKE_C_COMPILER_ID} C and ${CMAKE_Fortran_COMPILER_ID} Fortran not known to be compatible!")
  7. return()
  8. endif()
  9. # Wipe out all FortranCInterface information to ensure it re-runs.
  10. file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterface)
  11. if(FortranC_TEST_FLAGS)
  12. # Test whether FortranCInterface checks see C flags.
  13. set(ENV{TEST_OPT_CC} "--test-opt-cc=1")
  14. set(CMAKE_C_FLAGS "$ENV{TEST_OPT_CC} ${CMAKE_C_FLAGS}")
  15. # Test whether FortranCInterface checks see Fortran flags.
  16. set(ENV{TEST_OPT_FC} "--test-opt-fc=1")
  17. set(CMAKE_Fortran_FLAGS "$ENV{TEST_OPT_FC} ${CMAKE_Fortran_FLAGS}")
  18. endif()
  19. include(FortranCInterface)
  20. FortranCInterface_VERIFY()