Skip to content

Commit

Permalink
#350: Update CMake variables for examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Jun 20, 2024
1 parent d06190c commit d0d064d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if (magistrate_ubsan_enabled)
endif()

set(CHECKPOINT_LIBRARY checkpoint CACHE INTERNAL "" FORCE )
set(CHECKPOINT_LIBRARY_NS vt::lib::checkpoint "" CACHE INTERNAL "" FORCE )
set(MAGISTRATE_LIBRARY_NS vt::lib::checkpoint "" CACHE INTERNAL "" FORCE )

set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
10 changes: 5 additions & 5 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

macro(add_test_for_example_checkpoint test_name test_exec)
macro(add_test_for_example_magistrate test_name test_exec)
add_test(
${test_name} ${test_exec} ${ARGN}
)
Expand All @@ -18,7 +18,7 @@ file(
"${PROJECT_EXAMPLE_DIR}/*.cc"
)

if (checkpoint_examples_enabled)
if (magistrate_examples_enabled)
foreach(EXAMPLE_FULL ${PROJECT_EXAMPLES})
GET_FILENAME_COMPONENT(
EXAMPLE
Expand All @@ -32,15 +32,15 @@ if (checkpoint_examples_enabled)
)
target_include_directories(${EXAMPLE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../src)

add_test_for_example_checkpoint(
checkpoint:${EXAMPLE}
add_test_for_example_magistrate(
magistrate:${EXAMPLE}
${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}
)

target_link_libraries(
${EXAMPLE}
PUBLIC
${CHECKPOINT_LIBRARY_NS}
${MAGISTRATE_LIBRARY_NS}
)

endforeach()
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ add_library(
${HEADER_FILES} ${SOURCE_FILES}
)

add_library(${CHECKPOINT_LIBRARY_NS} ALIAS ${CHECKPOINT_LIBRARY})
add_library(${MAGISTRATE_LIBRARY_NS} ALIAS ${CHECKPOINT_LIBRARY})

target_compile_features(${CHECKPOINT_LIBRARY} PUBLIC cxx_std_17)

Expand Down
28 changes: 14 additions & 14 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ file(
)

#
# Setup a potential target (a test, example, etc. that uses checkpoint) will all
# Setup a potential target (a test, example, etc. that uses magistrate) will all
# the libraries to link, include directories, definitions
#
macro(checkpoint_link_target target has_mpi)
macro(magistrate_link_target target has_mpi)
target_include_directories(${target} PUBLIC ${PROJECT_TEST_UNIT_DIR})
target_link_libraries(${target} PRIVATE GTest::gtest GTest::gtest_main)
target_link_libraries(${target} PRIVATE Threads::Threads)
Expand All @@ -39,16 +39,16 @@ macro(checkpoint_link_target target has_mpi)
endmacro()

if (magistrate_tests_enabled)
if (NOT CHECKPOINT_HAS_GTEST)
if (NOT MAGISTRATE_HAS_GTEST)
message(
STATUS
"Checkpoint: Unit test are disabled because GoogleTest is not setup:"
"Magistrate: Unit test are disabled because GoogleTest is not setup:"
"gtest_DIR=${gtest_DIR}"
)
else()
message(
STATUS
"Checkpoint: GTEST package is found: unit tests are enabled "
"Magistrate: GTEST package is found: unit tests are enabled "
"gtest_DIR=${gtest_DIR}, GTEST_ROOT=${GTEST_ROOT}"
)

Expand Down Expand Up @@ -87,22 +87,22 @@ if (magistrate_tests_enabled)
${PROJECT_TEST_UNIT_DIR}/${TEST}.cc
)

checkpoint_link_target(${TEST} 0)
magistrate_link_target(${TEST} 0)

add_test(
checkpoint:${TEST}
magistrate:${TEST}
${CMAKE_CURRENT_BINARY_DIR}/${TEST}
)

set_tests_properties(
checkpoint:${TEST}
magistrate:${TEST}
PROPERTIES TIMEOUT 60
FAIL_REGULAR_EXPRESSION "FAILED;should be deleted but never is"
PASS_REGULAR_EXPRESSION "PASSED"
)
endforeach()

if(checkpoint_mpi_enabled)
if(magistrate_mpi_enabled)
foreach(TEST_FULL ${PROJECT_TEST_LIST_MPI})
GET_FILENAME_COMPONENT(
TEST
Expand All @@ -116,19 +116,19 @@ if (magistrate_tests_enabled)
${PROJECT_TEST_MPI_UNIT_DIR}/${TEST}.cc
)

checkpoint_link_target(${TEST} 1)
magistrate_link_target(${TEST} 1)

set(
CHECKPOINT_TEST_PARAM_MPI ${MPI_NUMPROC_FLAG}
MAGISTRATE_TEST_PARAM_MPI ${MPI_NUMPROC_FLAG}
${MAGISTRATE_MPI_PROC} "${CMAKE_CURRENT_BINARY_DIR}/${TEST}"
)
add_test(
NAME checkpoint:${TEST}
COMMAND ${MPI_RUN_COMMAND} ${CHECKPOINT_TEST_PARAM_MPI}
NAME magistrate:${TEST}
COMMAND ${MPI_RUN_COMMAND} ${MAGISTRATE_TEST_PARAM_MPI}
)

set_tests_properties(
checkpoint:${TEST}
magistrate:${TEST}
PROPERTIES TIMEOUT 60
FAIL_REGULAR_EXPRESSION "FAILED;should be deleted but never is"
PASS_REGULAR_EXPRESSION "PASSED"
Expand Down

0 comments on commit d0d064d

Please sign in to comment.