diff --git a/examples/hello/bpWriter/CMakeLists.txt b/examples/hello/bpWriter/CMakeLists.txt index 3518b42787191b823fce4f840f9275693867b8f3..67e193342b05fe0c7d99881038a69e5233706fda 100644 --- a/examples/hello/bpWriter/CMakeLists.txt +++ b/examples/hello/bpWriter/CMakeLists.txt @@ -8,7 +8,16 @@ if(ADIOS_USE_MPI) add_executable(hello_bpWriter helloBPWriter.cpp) target_include_directories(hello_bpWriter PRIVATE ${MPI_C_INCLUDE_PATH}) target_link_libraries(hello_bpWriter adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test( NAME Example::hello::bpWriter COMMAND hello_bpWriter) + endif() +else() + add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp) + target_link_libraries(hello_bpWriter_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( NAME Example::hello::bpWriter_nompi COMMAND hello_bpWriter_nompi) + endif() endif() -add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp) -target_link_libraries(hello_bpWriter_nompi adios2) diff --git a/examples/hello/datamanReader/CMakeLists.txt b/examples/hello/datamanReader/CMakeLists.txt index f32a2283869203b1157cdb67dc540fe19b7ef90d..3aa3e264ad829cf697e9cd91a6336d6fcf8b668d 100644 --- a/examples/hello/datamanReader/CMakeLists.txt +++ b/examples/hello/datamanReader/CMakeLists.txt @@ -3,8 +3,26 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -add_executable(hello_datamanReader helloDataManReader.cpp) -target_link_libraries(hello_datamanReader adios2) +if(ADIOS_USE_MPI) + find_package(MPI COMPONENTS C REQUIRED) -add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp) -target_link_libraries(hello_datamanReader_nompi adios2) + add_executable(hello_datamanReader helloDataManReader.cpp) + target_link_libraries(hello_datamanReader adios2) + target_include_directories(hello_datamanReader PRIVATE ${MPI_C_INCLUDE_PATH}) + target_link_libraries(hello_datamanReader adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::datamanReader COMMAND hello_datamanReader) + endif() +else() + add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp) + target_link_libraries(hello_datamanReader_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::datamanReader_nompi + COMMAND hello_datamanReader_nompi + ) + endif() +endif() + diff --git a/examples/hello/datamanWriter/CMakeLists.txt b/examples/hello/datamanWriter/CMakeLists.txt index dee5f38e1823c4a55f22d53954d09c440e1c6ff4..7defd6c40b3bd2eba1802a4e6e99dd41f5de1697 100644 --- a/examples/hello/datamanWriter/CMakeLists.txt +++ b/examples/hello/datamanWriter/CMakeLists.txt @@ -3,8 +3,26 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -add_executable(hello_datamanWriter helloDataManWriter.cpp) -target_link_libraries(hello_datamanWriter adios2) +if(ADIOS_USE_MPI) + find_package(MPI COMPONENTS C REQUIRED) + + add_executable(hello_datamanWriter helloDataManWriter.cpp) + target_link_libraries(hello_datamanWriter adios2) + target_include_directories(hello_datamanWriter PRIVATE ${MPI_C_INCLUDE_PATH}) + target_link_libraries(hello_datamanWriter adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::datamanWriter COMMAND hello_datamanWriter) + endif() +else() + add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp) + target_link_libraries(hello_datamanWriter_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::datamanWriter_nompi + COMMAND hello_datamanWriter_nompi + ) + endif() +endif() -add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp) -target_link_libraries(hello_datamanWriter_nompi adios2) diff --git a/examples/hello/timeBP/CMakeLists.txt b/examples/hello/timeBP/CMakeLists.txt index a0e38282532c2bf6cd2c2c726a809e2dd2ea2cac..d86828c90625a3a4e34952730fcd6ed9631c2949 100644 --- a/examples/hello/timeBP/CMakeLists.txt +++ b/examples/hello/timeBP/CMakeLists.txt @@ -9,8 +9,18 @@ if(ADIOS_USE_MPI) target_link_libraries(hello_timeBPWriter adios2) target_include_directories(hello_timeBPWriter PRIVATE ${MPI_C_INCLUDE_PATH}) target_link_libraries(hello_timeBPWriter adios2 ${MPI_C_LIBRARIES}) -endif() + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::timeBPWriter COMMAND hello_timeBPWriter) + endif() +else() + add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp) + target_link_libraries(hello_timeBPWriter_nompi adios2) -add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp) -target_link_libraries(hello_timeBPWriter_nompi adios2) + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::timeBPWriter_nompi + COMMAND hello_timeBPWriter_nompi + ) + endif() +endif()