diff --git a/examples/basics/globalArray/CMakeLists.txt b/examples/basics/globalArray/CMakeLists.txt index 62192593245e554fb315dc3d56c18994d4661905..756f67c42f56ff41f2a90149f68cd4af1fa86dd0 100644 --- a/examples/basics/globalArray/CMakeLists.txt +++ b/examples/basics/globalArray/CMakeLists.txt @@ -7,6 +7,5 @@ add_executable(globalArray_write globalArray_write.cpp) target_link_libraries(globalArray_write adios2) if(ADIOS2_HAVE_MPI) - target_include_directories(globalArray_write PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(globalArray_write ${MPI_C_LIBRARIES}) + target_link_libraries(globalArray_write MPI::MPI_C) endif() diff --git a/examples/basics/joinedArray/CMakeLists.txt b/examples/basics/joinedArray/CMakeLists.txt index a0a7b06413911738666e6b968653cdb831ff9e26..9d52c2f0085f314937e83e8e1be9f82322416b30 100644 --- a/examples/basics/joinedArray/CMakeLists.txt +++ b/examples/basics/joinedArray/CMakeLists.txt @@ -7,6 +7,5 @@ add_executable(joinedArray_write joinedArray_write.cpp) target_link_libraries(joinedArray_write adios2) if(ADIOS2_HAVE_MPI) - target_include_directories(joinedArray_write PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(joinedArray_write ${MPI_C_LIBRARIES}) + target_link_libraries(joinedArray_write MPI::MPI_C) endif() diff --git a/examples/basics/localArray/CMakeLists.txt b/examples/basics/localArray/CMakeLists.txt index a42506de02aa74c4f4fef3c99c5c1e50e49ad19a..253298eddde195c9f2068731ce07dd0cbab53fa8 100644 --- a/examples/basics/localArray/CMakeLists.txt +++ b/examples/basics/localArray/CMakeLists.txt @@ -7,6 +7,5 @@ add_executable(localArray_write localArray_write.cpp) target_link_libraries(localArray_write adios2) if(ADIOS2_HAVE_MPI) - target_include_directories(localArray_write PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(localArray_write ${MPI_C_LIBRARIES}) + target_link_libraries(localArray_write MPI::MPI_C) endif() diff --git a/examples/basics/values/CMakeLists.txt b/examples/basics/values/CMakeLists.txt index 79e27ea6077d0e3e04400245a5e3e13409ddb09b..3f354e6fb981ca73871131578b9c7b951cacfba2 100644 --- a/examples/basics/values/CMakeLists.txt +++ b/examples/basics/values/CMakeLists.txt @@ -7,6 +7,5 @@ add_executable(values_write values_write.cpp) target_link_libraries(values_write adios2) if(ADIOS2_HAVE_MPI) - target_include_directories(values_write PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(values_write ${MPI_C_LIBRARIES}) + target_link_libraries(values_write MPI::MPI_C) endif() diff --git a/examples/experimental/multistep/CMakeLists.txt b/examples/experimental/multistep/CMakeLists.txt index 546074f51d6dc87c55e5ba822778e792953ae093..6da2c803f77a7b109b2c669da8fffd30fbfff933 100644 --- a/examples/experimental/multistep/CMakeLists.txt +++ b/examples/experimental/multistep/CMakeLists.txt @@ -3,15 +3,11 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -add_executable(writer_multistep writer_multistep.cpp) -add_executable(reader_stepping reader_stepping.cpp) -add_executable(reader_allsteps reader_allsteps.cpp) - foreach(tgt IN ITEMS writer_multistep reader_stepping reader_allsteps) + add_executable(${tgt} ${tgt}.cpp) target_link_libraries(${tgt} adios2) if(ADIOS2_HAVE_MPI) - target_include_directories(${tgt} PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(${tgt} ${MPI_C_LIBRARIES}) + target_link_libraries(${tgt} MPI::MPI_C) endif() endforeach() diff --git a/examples/experimental/runtimeconfig/hello/CMakeLists.txt b/examples/experimental/runtimeconfig/hello/CMakeLists.txt index 9770b299c4d377fdf6f0e8177c776db8dee817c5..d448030a5f52213714e95b9d8191ad785fc2349d 100644 --- a/examples/experimental/runtimeconfig/hello/CMakeLists.txt +++ b/examples/experimental/runtimeconfig/hello/CMakeLists.txt @@ -1,7 +1,6 @@ if(ADIOS2_HAVE_MPI) add_executable(helloBPWriterXML helloBPWriterXML.cpp) - target_include_directories(helloBPWriterXML PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(helloBPWriterXML ${MPI_C_LIBRARIES}) + target_link_libraries(helloBPWriterXML MPI::MPI_C) else() add_executable(helloBPWriterXML helloBPWriterXML_nompi.cpp) endif() diff --git a/examples/heatTransfer/read/CMakeLists.txt b/examples/heatTransfer/read/CMakeLists.txt index 30797b43a01f63f8af4808f25d97ab50cfbeb772..f14e54596ca5891401524289f561ed709e6afe55 100644 --- a/examples/heatTransfer/read/CMakeLists.txt +++ b/examples/heatTransfer/read/CMakeLists.txt @@ -5,18 +5,10 @@ if(ADIOS2_HAVE_MPI) add_executable(heatTransfer_read_adios2 heatRead_adios2.cpp PrintData.h) - target_include_directories(heatTransfer_read_adios2 - PRIVATE ${MPI_C_INCLUDE_PATH} - ) - target_link_libraries(heatTransfer_read_adios2 adios2 ${MPI_C_LIBRARIES}) + target_link_libraries(heatTransfer_read_adios2 adios2 MPI::MPI_C) if(ADIOS2_HAVE_ADIOS1) add_executable(heatTransfer_read_adios1 heatRead_adios1.cpp PrintData.h) - target_include_directories(heatTransfer_read_adios1 - PRIVATE ${MPI_C_INCLUDE_PATH} - ) - target_link_libraries(heatTransfer_read_adios1 - adios1::adios ${MPI_C_LIBRARIES} - ) + target_link_libraries(heatTransfer_read_adios1 adios1::adios MPI::MPI_C) endif() endif() diff --git a/examples/heatTransfer/write/CMakeLists.txt b/examples/heatTransfer/write/CMakeLists.txt index a6c459bca092e6f0c706f982e7b17a36f04caeab..51028cb8bc9c614239e2eabce8ec348b3add64ec 100644 --- a/examples/heatTransfer/write/CMakeLists.txt +++ b/examples/heatTransfer/write/CMakeLists.txt @@ -10,11 +10,8 @@ if(ADIOS2_HAVE_MPI) Settings.cpp IO_adios2.cpp ) - target_include_directories(heatTransfer_write_adios2 - PRIVATE ${MPI_C_INCLUDE_PATH} - ) target_link_libraries(heatTransfer_write_adios2 - adios2 ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + adios2 MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} ) target_compile_definitions(heatTransfer_write_adios2 PRIVATE -DDEFAULT_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/config.xml @@ -27,11 +24,8 @@ if(ADIOS2_HAVE_MPI) Settings.cpp IO_adios1.cpp ) - target_include_directories(heatTransfer_write_adios1 - PRIVATE ${MPI_C_INCLUDE_PATH} - ) target_link_libraries(heatTransfer_write_adios1 - adios1::adios ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + adios1::adios MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} ) endif() @@ -43,10 +37,10 @@ if(ADIOS2_HAVE_MPI) IO_hdf5_a.cpp ) target_include_directories(heatTransfer_write_hdf5 - PRIVATE ${MPI_C_INCLUDE_PATH} ${HDF5_C_INCLUDE_DIRS} + PRIVATE ${HDF5_C_INCLUDE_DIRS} ) target_link_libraries(heatTransfer_write_hdf5 - ${HDF5_C_LIBRARIES} ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + ${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} ) add_executable(heatTransfer_write_ph5 @@ -56,10 +50,10 @@ if(ADIOS2_HAVE_MPI) IO_ph5.cpp ) target_include_directories(heatTransfer_write_ph5 - PRIVATE ${MPI_C_INCLUDE_PATH} ${HDF5_C_INCLUDE_DIRS} + PRIVATE ${HDF5_C_INCLUDE_DIRS} ) target_link_libraries(heatTransfer_write_ph5 - ${HDF5_C_LIBRARIES} ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + ${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} ) add_executable(heatTransfer_write_a2h5 @@ -69,11 +63,8 @@ if(ADIOS2_HAVE_MPI) IO_ph5_adios2.cpp ) - target_include_directories(heatTransfer_write_a2h5 - PRIVATE ${MPI_C_INCLUDE_PATH} - ) target_link_libraries(heatTransfer_write_a2h5 - adios2 ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + adios2 MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT} ) endif() endif() diff --git a/examples/hello/adios1Writer/CMakeLists.txt b/examples/hello/adios1Writer/CMakeLists.txt index 3b5c016b66047fb21944652f17969120c67420c4..13f5f66f40852b42d4c97b0912b71ffc5cb9a5ae 100644 --- a/examples/hello/adios1Writer/CMakeLists.txt +++ b/examples/hello/adios1Writer/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_adios1Writer helloADIOS1Writer.cpp) - target_include_directories(hello_adios1Writer PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_adios1Writer ${MPI_C_LIBRARIES}) + target_link_libraries(hello_adios1Writer MPI::MPI_C) else() add_executable(hello_adios1Writer helloADIOS1Writer_nompi.cpp) endif() diff --git a/examples/hello/bpAttributeWriter/CMakeLists.txt b/examples/hello/bpAttributeWriter/CMakeLists.txt index 30faba4aff8d91e37bd65cb2e6792876200636d3..908d48c35525a85764fdb92ea16af8685af57896 100644 --- a/examples/hello/bpAttributeWriter/CMakeLists.txt +++ b/examples/hello/bpAttributeWriter/CMakeLists.txt @@ -7,8 +7,7 @@ if(ADIOS2_HAVE_MPI) find_package(MPI COMPONENTS C REQUIRED) add_executable(hello_bpAttributeWriter helloBPAttributeWriter.cpp) - target_include_directories(hello_bpAttributeWriter PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_bpAttributeWriter ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpAttributeWriter MPI::MPI_C) else() add_executable(hello_bpAttributeWriter helloBPAttributeWriter_nompi.cpp) diff --git a/examples/hello/bpBZip2Wrapper/CMakeLists.txt b/examples/hello/bpBZip2Wrapper/CMakeLists.txt index 702d5aaeb3383508227210f076aec4f43b7b117b..e1654cf16a63d84c9b2ef42289199d08a70eebaa 100644 --- a/examples/hello/bpBZip2Wrapper/CMakeLists.txt +++ b/examples/hello/bpBZip2Wrapper/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_bpBZip2Wrapper helloBPBZip2Wrapper.cpp) - target_include_directories(hello_bpBZip2Wrapper PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_bpBZip2Wrapper ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpBZip2Wrapper MPI::MPI_C) else() add_executable(hello_bpBZip2Wrapper helloBPBZip2Wrapper_nompi.cpp) endif() diff --git a/examples/hello/bpFlushWriter/CMakeLists.txt b/examples/hello/bpFlushWriter/CMakeLists.txt index 777704ef21ea820ac6d928dedb869fd323ea495c..43a55fc64c0da62ae5775d5af4d8004b63be8469 100644 --- a/examples/hello/bpFlushWriter/CMakeLists.txt +++ b/examples/hello/bpFlushWriter/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_bpFlushWriter helloBPFlushWriter.cpp) - target_include_directories(hello_bpFlushWriter PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_bpFlushWriter ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpFlushWriter MPI::MPI_C) else() add_executable(hello_bpFlushWriter helloBPFlushWriter_nompi.cpp) endif() diff --git a/examples/hello/bpTimeWriter/CMakeLists.txt b/examples/hello/bpTimeWriter/CMakeLists.txt index 68834e2887d52954186e6f5e6b9d20b70ed38ec9..d3f8bc7d87339d8a876a71b96bc8d2b74265fe6d 100644 --- a/examples/hello/bpTimeWriter/CMakeLists.txt +++ b/examples/hello/bpTimeWriter/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_bpTimeWriter helloBPTimeWriter.cpp) - target_include_directories(hello_bpTimeWriter PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_bpTimeWriter ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpTimeWriter MPI::MPI_C) else() add_executable(hello_bpTimeWriter helloBPTimeWriter_nompi.cpp) endif() diff --git a/examples/hello/bpWriter/CMakeLists.txt b/examples/hello/bpWriter/CMakeLists.txt index 8c834597ac2748dc398d3323c4cac038a179d674..3f3f19f4ad3a598a22acf46f1e3270a03cd02c21 100644 --- a/examples/hello/bpWriter/CMakeLists.txt +++ b/examples/hello/bpWriter/CMakeLists.txt @@ -5,21 +5,14 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_bpWriter helloBPWriter.cpp) - target_include_directories(hello_bpWriter PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_bpWriter ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpWriter MPI::MPI_C) add_executable(hello_bpWriter_c helloBPWriter.c) - target_include_directories(hello_bpWriter_c PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_bpWriter_c ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpWriter_c MPI::MPI_C) if(ADIOS2_HAVE_Fortran) add_executable(hello_bpWriter_f helloBPWriter.f90) - target_include_directories(hello_bpWriter_f - PRIVATE ${MPI_Fortran_INCLUDE_PATH} - ${MPI_C_INCLUDE_PATH}) - - target_link_libraries(hello_bpWriter_f PRIVATE ${MPI_Fortran_LIBRARIES} - ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpWriter_f MPI::MPI_Fortran adios2_f) endif() else() @@ -28,13 +21,9 @@ else() if(ADIOS2_HAVE_Fortran) add_executable(hello_bpWriter_f helloBPWriter_nompi.f90) + target_link_libraries(hello_bpWriter_f adios2_f) endif() - endif() target_link_libraries(hello_bpWriter adios2) target_link_libraries(hello_bpWriter_c adios2) - -if(ADIOS2_HAVE_Fortran) - target_link_libraries(hello_bpWriter_f PRIVATE adios2_f) -endif() diff --git a/examples/hello/bpZfpWrapper/CMakeLists.txt b/examples/hello/bpZfpWrapper/CMakeLists.txt index c6802384e091d450d900ddb90599ab707dde5a9c..5593e42dbf50fa76dd17d6b393e4198ccdfe58c5 100644 --- a/examples/hello/bpZfpWrapper/CMakeLists.txt +++ b/examples/hello/bpZfpWrapper/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_bpZfpWrapper helloBPZfpWrapper.cpp) - target_include_directories(hello_bpZfpWrapper PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_bpZfpWrapper ${MPI_C_LIBRARIES}) + target_link_libraries(hello_bpZfpWrapper MPI::MPI_C) else() add_executable(hello_bpZfpWrapper helloBPZfpWrapper_nompi.cpp) diff --git a/examples/hello/datamanReader/CMakeLists.txt b/examples/hello/datamanReader/CMakeLists.txt index 1c1baa846fe64e3357d0a82b90354cca50cccde7..66a87b8890aa64688e2029a464b0438a206f63e2 100644 --- a/examples/hello/datamanReader/CMakeLists.txt +++ b/examples/hello/datamanReader/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_datamanReader helloDataManReader.cpp) - target_include_directories(hello_datamanReader PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_datamanReader ${MPI_C_LIBRARIES}) + target_link_libraries(hello_datamanReader MPI::MPI_C) else() add_executable(hello_datamanReader helloDataManReader_nompi.cpp) endif() diff --git a/examples/hello/datamanWriter/CMakeLists.txt b/examples/hello/datamanWriter/CMakeLists.txt index 4a41f3e730d4032f05c09dffe7c381cf6d7cc917..83196e95fae0dc070af9f4fb196506f0b04077dc 100644 --- a/examples/hello/datamanWriter/CMakeLists.txt +++ b/examples/hello/datamanWriter/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_datamanWriter helloDataManWriter.cpp) - target_include_directories(hello_datamanWriter PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_datamanWriter ${MPI_C_LIBRARIES}) + target_link_libraries(hello_datamanWriter MPI::MPI_C) else() add_executable(hello_datamanWriter helloDataManWriter_nompi.cpp) endif() diff --git a/examples/hello/hdf5Writer/CMakeLists.txt b/examples/hello/hdf5Writer/CMakeLists.txt index d5d4311250ddd6cd76a2909f88d53ea17da3eb81..6ca2b27524f85792555e0e4ff689226085398628 100644 --- a/examples/hello/hdf5Writer/CMakeLists.txt +++ b/examples/hello/hdf5Writer/CMakeLists.txt @@ -5,8 +5,7 @@ if(ADIOS2_HAVE_MPI) add_executable(hello_hdf5Writer helloHDF5Writer.cpp) - target_include_directories(hello_hdf5Writer PRIVATE ${MPI_C_INCLUDE_PATH}) - target_link_libraries(hello_hdf5Writer ${MPI_C_LIBRARIES}) + target_link_libraries(hello_hdf5Writer MPI::MPI_C) else() add_executable(hello_hdf5Writer helloHDF5Writer_nompi.cpp) endif()