build: Limit scope of MPI definition and include directory
This commit is contained in:
committed by
Gabriel Ferreira
parent
3192d8f936
commit
f67ff99635
@@ -840,8 +840,7 @@ macro(process_options)
|
||||
message(FATAL_ERROR "MPI was not found.")
|
||||
else()
|
||||
message(STATUS "MPI was found.")
|
||||
add_definitions(-DNS3_MPI)
|
||||
include_directories(${MPI_CXX_INCLUDE_DIRS})
|
||||
target_compile_definitions(MPI::MPI_CXX INTERFACE NS3_MPI)
|
||||
set(ENABLE_MPI TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -2855,7 +2855,7 @@ followed by a header configuration:
|
||||
else()
|
||||
# If it is false, we add necessary C++ definitions (e.g. NS3_MPI)
|
||||
message(STATUS "MPI was found.")
|
||||
add_definitions(-DNS3_MPI)
|
||||
target_compile_definitions(MPI::MPI_CXX INTERFACE NS3_MPI)
|
||||
|
||||
# Then set ENABLE_MPI to TRUE, which can be used to check
|
||||
# if NS3_MPI is enabled AND MPI was found
|
||||
|
||||
@@ -20,6 +20,6 @@ if(${ENABLE_MPI})
|
||||
${libnix-vector-routing}
|
||||
${libapplications}
|
||||
${libmpi}
|
||||
${MPI_CXX_LIBRARIES}
|
||||
MPI::MPI_CXX
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -22,6 +22,6 @@ build_lib(
|
||||
model/mpi-receiver.h
|
||||
model/parallel-communication-interface.h
|
||||
LIBRARIES_TO_LINK ${libnetwork}
|
||||
${MPI_CXX_LIBRARIES}
|
||||
MPI::MPI_CXX
|
||||
TEST_SOURCES ${example_as_test_suite}
|
||||
)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
link_libraries(${MPI_CXX_LIBRARIES})
|
||||
|
||||
set(base_examples
|
||||
simple-distributed
|
||||
simple-distributed-mpi-comm
|
||||
|
||||
@@ -11,7 +11,7 @@ if(${ENABLE_MPI})
|
||||
)
|
||||
set(mpi_libraries
|
||||
${libmpi}
|
||||
${MPI_CXX_LIBRARIES}
|
||||
MPI::MPI_CXX
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user