From 260daa94bd7a645d8525b95a3ff24a6e936ab917 Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Mon, 4 Feb 2008 22:04:31 +0000 Subject: [PATCH] cmake: prefer the use of target_link_libraries() over set_target_properties(LINKFLAGS), make sure we don't use "-z defs --as-needed" on Mac OS X. --- .../cmake/CMakeLists/src_CMakeLists.txt | 16 +++++++++++----- extras/buildsystem/cmake/include/config.cmake | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/extras/buildsystem/cmake/CMakeLists/src_CMakeLists.txt b/extras/buildsystem/cmake/CMakeLists/src_CMakeLists.txt index 49c473e90c..dd11402c9e 100644 --- a/extras/buildsystem/cmake/CMakeLists/src_CMakeLists.txt +++ b/extras/buildsystem/cmake/CMakeLists/src_CMakeLists.txt @@ -134,9 +134,6 @@ endif(SYS_DARWIN) add_library(libvlc SHARED ${SOURCES_libvlc}) install_targets(/lib libvlc) -set_target_properties(libvlc PROPERTIES LINK_FLAGS - "-z defs --as-needed -lm ${LIBRT} ${LIBICONV} ${CMAKE_THREAD_LIBS_INIT}") -set_target_properties(libvlc PROPERTIES SOVERSION 1.0.0) # libvlc-control set( SOURCES_libvlc_control @@ -193,7 +190,7 @@ OUTPUT ${rev} COMMAND rm -f ${rev} ${rev}.tmp COMMAND echo "/* AUTOGENERATED FILE - DO NOT EDIT */" > ${rev}.tmp COMMAND printf "const char psz_vlc_changeset[] = \"" >> ${rev}.tmp -COMMAND sh -c "printf `LANG=C\ svnversion\ ${CMAKE_SOURCE_DIR}\ ||\ echo\ exported`" >> ${rev}.tmp +COMMAND sh -c "printf `LANG=C svnversion ${CMAKE_SOURCE_DIR} || printf \"exported\"`" >> ${rev}.tmp COMMAND echo "\";" >> ${rev}.tmp COMMAND mv -f ${rev}.tmp ${rev} VERBATIM @@ -238,10 +235,19 @@ DEPENDS ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/THANKS ${CMAKE_SOURCE_DI VERBATIM) set(about) + ########################################################## # SET_TARGET_PROPERTIES +# FIXME: Should probably be autodetected in configure? +if(NOT APPLE) + set(LINK_FLAGS "-z defs --as-needed") +endif(NOT APPLE) + +target_link_libraries(libvlc ${LIBRT} ${LIBICONV}) + +set_target_properties(libvlc PROPERTIES SOVERSION 1.0.0) set_target_properties(libvlc libvlc-control PROPERTIES PREFIX "") -set_target_properties(libvlc-control PROPERTIES LINK_FLAGS "-z defs --as-needed") +set_target_properties(libvlc libvlc-control PROPERTIES LINK_FLAGS "${LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") set_target_properties(libvlc libvlc-control vlc PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wmissing-prototypes" ) diff --git a/extras/buildsystem/cmake/include/config.cmake b/extras/buildsystem/cmake/include/config.cmake index b08b6604d1..801fc39b9b 100644 --- a/extras/buildsystem/cmake/include/config.cmake +++ b/extras/buildsystem/cmake/include/config.cmake @@ -80,7 +80,7 @@ set(LIBICONV "") vlc_check_functions_exist(iconv) if(NOT HAVE_ICONV) - set(LIBICONV "-liconv") + set(LIBICONV "iconv") check_library_exists(iconv iconv "" HAVE_ICONV) endif(NOT HAVE_ICONV) # FIXME: this will break on *BSD: @@ -88,7 +88,7 @@ set( ICONV_CONST "" ) check_library_exists(rt clock_nanosleep "" HAVE_CLOCK_NANOSLEEP) if (HAVE_CLOCK_NANOSLEEP) - set(LIBRT "-lrt") + set(LIBRT "rt") endif (HAVE_CLOCK_NANOSLEEP) ########################################################### -- GitLab