diff options
author | Christoph Cullmann <cullmann@kde.org> | 2022-05-20 19:21:21 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2022-06-06 22:37:42 +0000 |
commit | b01c2150b09ba50de34e08d2d5ccf53359905b5f (patch) | |
tree | 634385c5a6ae86c4bffa13e4e7fa4737bdd6ef16 | |
parent | 6f8e9ff84b959ba763fcff18f0c519075ea1df03 (diff) | |
download | extra-cmake-modules-b01c2150b09ba50de34e08d2d5ccf53359905b5f.tar.gz extra-cmake-modules-b01c2150b09ba50de34e08d2d5ccf53359905b5f.tar.bz2 |
fix linking on OpenBSD
OpenBSD has a similar patch inside the ports, see
Allow KDE5 libraries to be built without having to link to libc explicitly.
Index: kde-modules/KDECompilerSettings.cmake
--- kde-modules/KDECompilerSettings.cmake.orig
+++ kde-modules/KDECompilerSettings.cmake
@@ -530,6 +530,8 @@ endfunction()
# Better diagnostics (warnings, errors)
############################################################
+set(ALLOW_UNDEFINED_LIB_SYMBOLS No CACHE BOOL "allow undefined symbols in generated shared objects")
+
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32))
@@ -537,9 +539,11 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPL
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
- # Do not allow undefined symbols, even in non-symbolic shared libraries
- set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
- set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
+ if (NOT ${ALLOW_UNDEFINED_LIB_SYMBOLS})
+ # Do not allow undefined symbols, even in non-symbolic shared libraries
+ set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
+ endif()
endif()
set(_KDE_GCC_COMMON_WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef")
-rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 762cfc66..55b94c38 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -538,8 +538,11 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}") # Do not allow undefined symbols, even in non-symbolic shared libraries - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}") + # On OpenBSD we must disable this to allow the stuff to properly compile without explicit libc specification + if (NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}") + endif() endif() set(_KDE_GCC_COMMON_WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef") |