[x265] [PATCH 2 of 2] Always use -DPIC/-fPIC when targetting x64

funman at videolan.org funman at videolan.org
Fri Sep 6 16:13:26 CEST 2013


# HG changeset patch
# User Rafaël Carré <funman at videolan.org>
# Date 1378476609 -7200
# Node ID ae8499191c12af840d47def2654b79a4e886c96b
# Parent  63364b91b72a183ed18d2e9d22a4e7070b3bae60
Always use -DPIC/-fPIC when targetting x64

Fix link failure when making a shared object on Linux

diff -r 63364b91b72a -r ae8499191c12 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Fri Sep 06 01:45:16 2013 -0500
+++ b/source/CMakeLists.txt	Fri Sep 06 16:10:09 2013 +0200
@@ -13,6 +13,7 @@
 if ("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
     set(X64 1)
     add_definitions(-DX86_64=1)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
 endif()
 
 # Enforce coding standards.  Full warnings and warnings as errors
diff -r 63364b91b72a -r ae8499191c12 source/cmake/CMakeASM_YASMInformation.cmake
--- a/source/cmake/CMakeASM_YASMInformation.cmake	Fri Sep 06 01:45:16 2013 -0500
+++ b/source/cmake/CMakeASM_YASMInformation.cmake	Fri Sep 06 16:10:09 2013 +0200
@@ -2,9 +2,9 @@
 set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
 
 if(X64)
-    set(ASM_FLAGS "-DARCH_X86_64=1 -m amd64")
+    set(ASM_FLAGS "-DARCH_X86_64=1 -m amd64 -DPIC")
     if(APPLE)
-        set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1 "-f macho64 -DPREFIX -DPIC")
+        set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1 "-f macho64 -DPREFIX")
     elseif(UNIX)
         set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1 "-f elf64")
     else()


More information about the x265-devel mailing list