24 lines
997 B
Text
24 lines
997 B
Text
Allow linking without '-Wl,--as-needed', fix the build on clang+ld.bfd archs.
|
|
It's needed to do it like this since target_link_libraries takes preference
|
|
over LDFLAGS.
|
|
|
|
Index: CMakeLists.txt
|
|
--- CMakeLists.txt.orig
|
|
+++ CMakeLists.txt
|
|
@@ -72,6 +72,7 @@ set_verbose(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR} CA
|
|
option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF)
|
|
option(FMT_WERROR "Halt the compilation with an error on compiler warnings."
|
|
OFF)
|
|
+option(AS_NEEDED "Use -Wl,--as-needed for linking." ON)
|
|
|
|
# Options that control generation of various targets.
|
|
option(FMT_DOC "Generate the doc target." ${FMT_MASTER_PROJECT})
|
|
@@ -286,7 +287,7 @@ endif ()
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND
|
|
- NOT EMSCRIPTEN)
|
|
+ NOT EMSCRIPTEN AND AS_NEEDED)
|
|
# Fix rpmlint warning:
|
|
# unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6.
|
|
target_link_libraries(fmt -Wl,--as-needed)
|