From d36ae0e17f30acc2afd7d74b074bde1da791ee79 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 17 Sep 2006 17:20:08 +0200 Subject: [PATCH] use a macro to set the linker flags for executables --- CMakeLists.txt | 8 ++++++++ examples/CMakeLists.txt | 7 +------ examples/cpp/CMakeLists.txt | 7 +------ tools/xmlrpc/CMakeLists.txt | 7 +------ tools/xmlrpc_transport/CMakeLists.txt | 7 +------ 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ccbd371..1e86c61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,14 @@ macro(ensc_pkgconfig_lib TARGET LIBS) endif("${libtype}" STREQUAL "STATIC_LIBRARY") endmacro(ensc_pkgconfig_lib) +macro(ensc_set_link_exe_flags) + ## HACK: libwww has broken inter-lib dependencies and '-Wl,--as-needed' fails with it + if(NOT MUST_BUILD_LIBWWW_CLIENT) + set_target_properties(${ARGV} + PROPERTIES + LINK_FLAGS ${XMLRPC_LINKER_FLAGS}) + endif(NOT MUST_BUILD_LIBWWW_CLIENT) +endmacro(ensc_set_link_exe_flags) ########### diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4cbe95a..9f18b0d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -48,9 +48,4 @@ if(ENABLE_ABYSS_SERVER) ensc_add_example(xmlrpc_server_validatee c abyss_server) endif(ENABLE_ABYSS_SERVER) -## HACK: libwww has broken inter-lib dependencies and '-Wl,--as-needed' fails with it -if(NOT MUST_BUILD_LIBWWW_CLIENT) - set_target_properties(${example_TARGETS} - PROPERTIES - LINK_FLAGS ${XMLRPC_LINKER_FLAGS}) -endif(NOT MUST_BUILD_LIBWWW_CLIENT) +ensc_set_link_exe_flags(${example_TARGETS}) diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index c2e3ab7..9fbea7e 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -17,9 +17,4 @@ if(MUST_BUILD_CLIENT) endif(MUST_BUILD_CLIENT) -## HACK: libwww has broken inter-lib dependencies and '-Wl,--as-needed' fails with it -if(NOT MUST_BUILD_LIBWWW_CLIENT) - set_target_properties(${example_TARGETS} - PROPERTIES - LINK_FLAGS ${XMLRPC_LINKER_FLAGS}) -endif(NOT MUST_BUILD_LIBWWW_CLIENT) +ensc_set_link_exe_flags(${example_TARGETS}) diff --git a/tools/xmlrpc/CMakeLists.txt b/tools/xmlrpc/CMakeLists.txt index e313e37..a996e18 100644 --- a/tools/xmlrpc/CMakeLists.txt +++ b/tools/xmlrpc/CMakeLists.txt @@ -11,9 +11,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ RENAME xmlrpc) -## HACK: libwww has broken inter-lib dependencies and '-Wl,--as-needed' fails with it -if(NOT MUST_BUILD_LIBWWW_CLIENT) - set_target_properties(tool-xmlrpc - PROPERTIES - LINK_FLAGS ${XMLRPC_LINKER_FLAGS}) -endif(NOT MUST_BUILD_LIBWWW_CLIENT) +ensc_set_link_exe_flags(tool-xmlrpc) diff --git a/tools/xmlrpc_transport/CMakeLists.txt b/tools/xmlrpc_transport/CMakeLists.txt index 0575488..b73d7c0 100644 --- a/tools/xmlrpc_transport/CMakeLists.txt +++ b/tools/xmlrpc_transport/CMakeLists.txt @@ -6,9 +6,4 @@ target_link_libraries(xmlrpc_transport x install(TARGETS xmlrpc_transport DESTINATION ${_bin}) -## HACK: libwww has broken inter-lib dependencies and '-Wl,--as-needed' fails with it -if(NOT MUST_BUILD_LIBWWW_CLIENT) - set_target_properties(xmlrpc_transport - PROPERTIES - LINK_FLAGS ${XMLRPC_LINKER_FLAGS}) -endif(NOT MUST_BUILD_LIBWWW_CLIENT) +ensc_set_link_exe_flags(xmlrpc_transport) -- 1.4.2