[x265] [PATCH 2 of 6] cmake: generalize adding additional linker options

Steve Borho steve at borho.org
Fri Mar 6 18:07:19 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1425660565 21600
#      Fri Mar 06 10:49:25 2015 -0600
# Node ID cb0127e2669414101f2e2aff827762bbf04eb283
# Parent  c3d888d55f882a7f4c7f2a444c49d7f303a7f8ac
cmake: generalize adding additional linker options

diff -r c3d888d55f88 -r cb0127e26694 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Fri Mar 06 10:48:51 2015 -0600
+++ b/source/CMakeLists.txt	Fri Mar 06 10:49:25 2015 -0600
@@ -165,6 +165,7 @@
     set(FSANITIZE "" CACHE STRING "-fsanitize options for GCC/clang")
     if(FSANITIZE)
         add_definitions(-fsanitize=${FSANITIZE})
+        list(APPEND LINKER_OPTIONS "-fsanitize=${FSANITIZE}")
     endif()
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CC_VERSION)
 endif(GCC)
@@ -428,12 +429,12 @@
         endif()
     endif()
     set_target_properties(cli PROPERTIES OUTPUT_NAME x265)
-    if(FSANITIZE)
+    if(LINKER_OPTIONS)
         # clang and gcc need the sanitize options to be passed at link
         # time so the appropriate ASAN/TSAN runtime libraries can be
         # linked. Linking the cli to the static libx265 is usually
         # required (by setting ENABLE_SHARED to OFF)
-        set_target_properties(cli PROPERTIES LINK_FLAGS "-fsanitize=${FSANITIZE}")
+        set_target_properties(cli PROPERTIES LINK_FLAGS ${LINKER_OPTIONS})
     endif()
 
     install(TARGETS cli DESTINATION ${BIN_INSTALL_DIR})


More information about the x265-devel mailing list