Skip to content

Commit

Permalink
CMake: Explicit example location
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Jan 7, 2024
1 parent 86133b1 commit 0a7a62e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ macro (prima_add_c_test name)

# Within CI, we'd like to run with gdb so that if there's a segfault the logs will have a stacktrace we can use to investigate.
# Of course this can be run locally as well if you define CI in your environment.
if(NOT APPLE AND UNIX AND DEFINED ENV{CI}) # Apple security policy will not allow running gdb in CI
add_test (NAME example_${name}_c_with_gdb COMMAND gdb -batch --command=${CMAKE_BINARY_DIR}/cmdfile.gdb example_${name}_c_exe)
elseif(WIN32 AND DEFINED ENV{CI})
# For Windows we need to provide the full path to the executable since it is installed to a different directory
add_test (NAME example_${name}_c_with_gdb COMMAND gdb -batch --command=${CMAKE_BINARY_DIR}/cmdfile.gdb ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/example_${name}_c_exe.exe)
if(NOT APPLE AND DEFINED ENV{CI}) # Apple security policy will not allow running gdb in CI
add_test (NAME example_${name}_c_with_gdb COMMAND gdb -batch --command=${CMAKE_BINARY_DIR}/cmdfile.gdb $<TARGET_FILE:example_${name}_c_exe>)
endif()

add_dependencies(examples example_${name}_c_exe)
Expand Down
7 changes: 2 additions & 5 deletions fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,8 @@ macro (prima_add_f_test name)

# Within CI, we'd like to run with gdb so that if there's a segfault the logs will have a stacktrace we can use to investigate.
# Of course this can be run locally as well if you define CI in your environment.
if(NOT APPLE AND UNIX AND DEFINED ENV{CI}) # Apple security policy will not allow running gdb in CI
add_test (NAME example_${name}_fortran_with_gdb COMMAND gdb -batch --command=${CMAKE_BINARY_DIR}/cmdfile.gdb example_${name}_fortran_exe)
elseif(WIN32 AND DEFINED ENV{CI})
# For Windows we need to provide the full path to the executable since it is installed to a different directory
add_test (NAME example_${name}_fortran_with_gdb COMMAND gdb -batch --command=${CMAKE_BINARY_DIR}/cmdfile.gdb ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/example_${name}_fortran_exe.exe)
if(NOT APPLE AND DEFINED ENV{CI}) # Apple security policy will not allow running gdb in CI
add_test (NAME example_${name}_fortran_with_gdb COMMAND gdb -batch --command=${CMAKE_BINARY_DIR}/cmdfile.gdb $<TARGET_FILE:example_${name}_fortran_exe>)
endif()

add_dependencies(examples example_${name}_fortran_exe)
Expand Down

0 comments on commit 0a7a62e

Please sign in to comment.