Flags.cmake.in 1.1 KB

1234567891011121314151617181920212223242526272829
  1. set(src "@CMAKE_CURRENT_SOURCE_DIR@/FortranC")
  2. set(bld "@CMAKE_CURRENT_BINARY_DIR@/FortranC/Flags")
  3. # Create wrapper scripts for the compilers that check for expected
  4. # flags, remove them, and invoke the real compiler.
  5. set(ID "CC")
  6. set(COMMAND "@CMAKE_C_COMPILER@")
  7. configure_file("${src}/test_opt.sh.in" "${bld}/cc.sh" @ONLY)
  8. set(ID "FC")
  9. set(COMMAND "@CMAKE_Fortran_COMPILER@")
  10. configure_file("${src}/test_opt.sh.in" "${bld}/fc.sh" @ONLY)
  11. set(ID)
  12. set(COMMAND)
  13. execute_process(
  14. WORKING_DIRECTORY "${bld}"
  15. COMMAND ${CMAKE_COMMAND} "${src}" -G "@CMAKE_TEST_GENERATOR@"
  16. -T "@CMAKE_TEST_GENERATOR_TOOLSET@"
  17. "-DFortranC_TEST_FLAGS=1"
  18. "-DCMAKE_C_COMPILER=${bld}/cc.sh"
  19. "-DCMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@"
  20. "-DCMAKE_Fortran_COMPILER=${bld}/fc.sh"
  21. "-DCMAKE_Fortran_FLAGS:STRING=@CMAKE_Fortran_FLAGS@"
  22. RESULT_VARIABLE result
  23. )
  24. if(NOT "${result}" STREQUAL "0")
  25. message(FATAL_ERROR "Configuration failed: ${result}")
  26. endif()