From 4df3e7cba29a9bb25a70badbc9de8aeef3693933 Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 28 Aug 2020 21:12:58 +0100 Subject: [PATCH] Link cadabra2.so to libpython.so if system requires it. --- core/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 1d4c9851da..71570db28f 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -305,6 +305,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set_target_properties(cadabra2 PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(cadabra2 PRIVATE ${PYTHON_LIBRARIES}) +elseif(CMAKE_SHARED_LINKER_FLAGS MATCHES ".*-Wl,--no-undefined.*") + # Exception for systems that require no undefined symbols present + # in shared libraries (e.g. openSUSE). + message("-- Linking cadabra2.so to libpython.so because of default linker flags.") + target_link_libraries(cadabra2 PRIVATE ${PYTHON_LIBRARIES}) endif() if(ENABLE_SYSTEM_JSONCPP)