diff --git a/cmake/modules/mamico.cmake b/cmake/modules/mamico.cmake index a0657fd1c9..5d4a6ed549 100644 --- a/cmake/modules/mamico.cmake +++ b/cmake/modules/mamico.cmake @@ -2,6 +2,7 @@ option(MAMICO_COUPLING "Couple with MaMiCo" OFF) if (MAMICO_COUPLING) message(STATUS "MaMiCo coupling enabled. ls1 mardyn will compile as library. No executable will be created.") set(MAMICO_COMPILE_DEFINITIONS MAMICO_COUPLING MDDim3) + option(MAMICO_ENABLE_FPIC "Enable -fPIC flag for MaMiCo python bindings" OFF) set(MAMICO_SRC_DIR CACHE PATH "Root directory of the MaMiCo codebase") if(NOT MAMICO_SRC_DIR) message(FATAL_ERROR "MaMiCo source directory not specified.") @@ -9,6 +10,9 @@ if (MAMICO_COUPLING) if(ENABLE_MPI) set(MAMICO_MPI_DEFINITIONS MDCoupledParallel TarchParallel) endif() + if(MAMICO_ENABLE_FPIC) + set(MAMICO_COMPILE_OPTIONS "${MAMICO_COMPILE_OPTIONS} -fPIC") + endif() else() message(STATUS "MaMiCo coupling disabled.") endif() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5992cdd3d1..f204718945 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,7 +54,7 @@ if (MAMICO_COUPLING) TARGET_COMPILE_DEFINITIONS(MarDyn PUBLIC ${MAMICO_COMPILE_DEFINITIONS} ${MAMICO_MPI_DEFINITIONS} ) - TARGET_COMPILE_OPTIONS(MarDyn PUBLIC -fPIC) + TARGET_COMPILE_OPTIONS(MarDyn PUBLIC ${MAMICO_COMPILE_OPTIONS}) else() ADD_EXECUTABLE(MarDyn ${MY_SRC}