[CMake] Use POSITION_INDEPENDENT_CODE property instead of manually setting -fPIC (Alchemy sync)

This commit is contained in:
Router Gray
2019-12-20 16:19:21 -06:00
parent 6608dd0b8d
commit 0496374328
9 changed files with 18 additions and 60 deletions

View File

@@ -269,12 +269,6 @@ list(APPEND llcommon_SOURCE_FILES ${cwdebug_SOURCE_FILES})
list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
if(NOT WORD_SIZE EQUAL 32)
if(NOT WINDOWS)
add_definitions(-fPIC)
endif(NOT WINDOWS)
endif(NOT WORD_SIZE EQUAL 32)
if(LLCOMMON_LINK_SHARED)
add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
if(WINDOWS)
@@ -286,6 +280,8 @@ else(LLCOMMON_LINK_SHARED)
add_library (llcommon ${llcommon_SOURCE_FILES})
endif(LLCOMMON_LINK_SHARED)
set_target_properties(llcommon PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(
llcommon
PUBLIC

View File

@@ -46,14 +46,6 @@ set(llplugin_HEADER_FILES
set_source_files_properties(${llplugin_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
if(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
# add_definitions(/FIXED:NO)
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(WINDOWS)
endif (NOT WORD_SIZE EQUAL 32)
list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
add_library (llplugin ${llplugin_SOURCE_FILES})
@@ -67,6 +59,8 @@ else()
)
endif()
set_target_properties(llplugin PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
add_subdirectory(slplugin)
# # Add tests

View File

@@ -15,14 +15,6 @@ include_directories(
### basic_plugin_base
if(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
# add_definitions(/FIXED:NO)
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(WINDOWS)
endif (NOT WORD_SIZE EQUAL 32)
set(basic_plugin_base_SOURCE_FILES
basic_plugin_base.cpp
)
@@ -42,6 +34,8 @@ add_library(basic_plugin_base
${basic_plugin_base_SOURCE_FILES}
)
set_target_properties(basic_plugin_base PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(basic_plugin_base
PUBLIC
llcommon

View File

@@ -29,14 +29,6 @@ include_directories(
### media_plugin_base
if(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
# add_definitions(/FIXED:NO)
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(WINDOWS)
endif (NOT WORD_SIZE EQUAL 32)
set(media_plugin_base_SOURCE_FILES
media_plugin_base.cpp
)
@@ -56,6 +48,8 @@ add_library(media_plugin_base
${media_plugin_base_SOURCE_FILES}
)
set_target_properties(media_plugin_base PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(media_plugin_base
PUBLIC
llcommon

View File

@@ -35,12 +35,6 @@ include_directories(SYSTEM
### media_plugin_cef
if(NOT WORD_SIZE EQUAL 32)
if(NOT WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(NOT WINDOWS)
endif(NOT WORD_SIZE EQUAL 32)
set(media_plugin_cef_SOURCE_FILES
media_plugin_cef.cpp
)
@@ -95,6 +89,8 @@ add_dependencies(media_plugin_cef
${LLCOMMON_LIBRARIES}
)
set_target_properties(media_plugin_cef PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(media_plugin_cef
${media_plugin_cef_LINK_LIBRARIES}
)

View File

@@ -17,14 +17,6 @@ include_directories(
### basic_plugin_example
if(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
# add_definitions(/FIXED:NO)
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(WINDOWS)
endif (NOT WORD_SIZE EQUAL 32)
set(basic_plugin_example_SOURCE_FILES
basic_plugin_example.cpp
)
@@ -34,6 +26,8 @@ add_library(basic_plugin_example
${basic_plugin_example_SOURCE_FILES}
)
set_target_properties(basic_plugin_example PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(basic_plugin_example
${LLPLUGIN_LIBRARIES}
${LLCOMMON_LIBRARIES}

View File

@@ -28,14 +28,6 @@ include_directories(
### media_plugin_example
if(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
# add_definitions(/FIXED:NO)
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(WINDOWS)
endif (NOT WORD_SIZE EQUAL 32)
set(media_plugin_example_SOURCE_FILES
media_plugin_example.cpp
)
@@ -45,6 +37,8 @@ add_library(media_plugin_example
${media_plugin_example_SOURCE_FILES}
)
set_target_properties(media_plugin_example PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(media_plugin_example
${LLPLUGIN_LIBRARIES}
${MEDIA_PLUGIN_BASE_LIBRARIES}

View File

@@ -23,14 +23,6 @@ include_directories(
### basic_plugin_filepicker
if(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
# add_definitions(/FIXED:NO)
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(WINDOWS)
endif (NOT WORD_SIZE EQUAL 32)
set(basic_plugin_filepicker_SOURCE_FILES
basic_plugin_filepicker.cpp
legacy.cpp
@@ -71,6 +63,8 @@ if (DARWIN)
set(OSX_FILE_LIBRARIES ${APPKIT_LIBRARY} ${CARBON_LIBRARY} ${IOKIT_LIBRARY})
endif (DARWIN)
set_target_properties(basic_plugin_filepicker PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(basic_plugin_filepicker
${LLPLUGIN_LIBRARIES}
${LLCOMMON_LIBRARIES}

View File

@@ -45,6 +45,8 @@ add_library(media_plugin_gstreamer010
${media_plugin_gstreamer010_SOURCE_FILES}
)
set_target_properties(media_plugin_gstreamer010 PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(media_plugin_gstreamer010
${LLPLUGIN_LIBRARIES}
${MEDIA_PLUGIN_BASE_LIBRARIES}