Skip to content

Commit

Permalink
use adios2::core in external build mode, use adios2_core in internal …
Browse files Browse the repository at this point in the history
…build mode to get access to adios2::helper functions
  • Loading branch information
pnorbert committed Mar 2, 2024
1 parent ff001fc commit a101990
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions examples/basics/values/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,30 @@ if(NOT TARGET adios2_core)
list(APPEND _components CXX)

find_package(ADIOS2 REQUIRED COMPONENTS ${_components})

# add adios2::core when using adios2::helper::* functions outside the ADIOS2 build
list(APPEND _other_dependencies adios2::core)
else()
# add adios2_core when using adios2::helper::* functions within the ADIOS2 build
list(APPEND _other_dependencies adios2_core)
endif()

add_executable(adios2_basics_valuesWrite valuesWrite.cpp)
target_link_libraries(adios2_basics_valuesWrite adios2::cxx11)
install(TARGETS adios2_basics_valuesWrite RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

add_executable(adios2_basics_valuesRead valuesRead.cpp)
# add adios2_core when using adios2::helper::* functions
target_link_libraries(adios2_basics_valuesRead adios2::cxx11 adios2_core)
target_link_libraries(adios2_basics_valuesRead adios2::cxx11 ${_other_dependencies})
install(TARGETS adios2_basics_valuesRead RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

add_executable(adios2_basics_valuesReadRandom valuesReadRandom.cpp)
# add adios2_core when using adios2::helper::* functions
target_link_libraries(adios2_basics_valuesReadRandom adios2::cxx11 adios2_core)
target_link_libraries(adios2_basics_valuesReadRandom adios2::cxx11 ${_other_dependencies})
install(TARGETS adios2_basics_valuesReadRandom RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if(ADIOS2_HAVE_MPI)
add_executable(adios2_basics_valuesWrite_mpi valuesWrite.cpp)
target_link_libraries(adios2_basics_valuesWrite_mpi adios2::cxx11_mpi adios2_core MPI::MPI_C)
target_link_libraries(adios2_basics_valuesWrite_mpi adios2::cxx11_mpi MPI::MPI_C)
install(TARGETS adios2_basics_valuesWrite_mpi RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if(ADIOS2_HAVE_Fortran)
Expand Down

0 comments on commit a101990

Please sign in to comment.