From 153c771a6ddc58df97b2ef860208a25a7437a4e4 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 27 Aug 2017 17:27:43 -0400 Subject: [PATCH] Use PIC in mpi_stubs when BUILD_SHARED_LIBS=on --- cmake/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 03f9b2f7f3..877f8d3e44 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -71,6 +71,9 @@ else() else() add_library(mpi_stubs STATIC ${MPI_SOURCES}) endif() + if(BUILD_SHARED_LIBS) + set_target_properties(mpi_stubs PROPERTIES POSITION_INDEPENDENT_CODE ON) + endif() include_directories(${LAMMPS_SOURCE_DIR}/STUBS) list(APPEND LAMMPS_LINK_LIBS mpi_stubs) endif()