Skip to content

Commit 5713bbb

Browse files
committed
cmake: try_run test required to catch subtly broken error stop compilers
1 parent 10eb08d commit 5713bbb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/tests/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ else()
2626
set(DISABLE_ESTOP_TESTS true)
2727
endif()
2828

29+
if(NOT DISABLE_ESTOP_TESTS AND NOT DEFINED es_run_out)
30+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/es_77.f90 "error stop 77; end")
31+
try_run(es_run_out es_build_out
32+
${CMAKE_CURRENT_BINARY_DIR}/estop
33+
${CMAKE_CURRENT_BINARY_DIR}/es_77.f90
34+
)
35+
if(NOT es_run_out EQUAL 77)
36+
set(DISABLE_ESTOP_TESTS true)
37+
endif()
38+
endif()
39+
2940
add_executable(test_error_handling test_error_driver.f90)
3041

3142
add_executable(test_always_77 test_always_77.f90)

0 commit comments

Comments
 (0)