support building plugins on MacOS (tested on version 11.0 aka Big Sur)

This commit is contained in:
Axel Kohlmeyer
2021-03-12 14:29:40 -05:00
parent c3f6fb914f
commit 7b4e143176
3 changed files with 40 additions and 2 deletions

View File

@ -53,4 +53,12 @@ target_link_libraries(nve2plugin PRIVATE lammps)
add_library(helloplugin MODULE helloplugin.cpp)
target_link_libraries(helloplugin PRIVATE lammps)
set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES PREFIX "")
set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES
PREFIX ""
LINK_FLAGS "-rdynamic")
# MacOS seems to need this
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES
LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
endif()