File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
1414set (FFMPEG_PKG_CONFIG_SUFFIX "" CACHE STRING "This suffix uses for FFmpeg component names searches by pkg-config" )
1515set (AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)" )
1616set (AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)" )
17+ set (AV_ENABLE_STATIC_PIC On CACHE BOOL "Enable Position Independent Code build for the statis library" )
1718set (AV_BUILD_EXAMPLES On CACHE BOOL "Build example applications (On)" )
1819set (AV_BUILD_TESTS On CACHE BOOL "Build tests (On)" )
1920option (AV_DISABLE_AVFORMAT "Disable libavformat usage. Also turns off: AVFILTER, AVDEVICE" Off )
Original file line number Diff line number Diff line change @@ -41,6 +41,12 @@ foreach(TARGET ${AV_TARGETS})
4141
4242 add_library (${TARGET} ${TYPE} ${AV_SOURCES} ${AV_HEADERS} )
4343
44+ # allow use static library to build shared one
45+ if (AV_ENABLE_STATIC_PIC AND ${TYPE} MATCHES "STATIC" )
46+ message (STATUS "Enable POSITION_INDEPENDENT_CODE (-fPIC) build for static library" )
47+ set_target_properties (${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON )
48+ endif ()
49+
4450 target_compile_options (${TARGET} PRIVATE ${AVCPP_WARNING_OPTIONS} )
4551 target_compile_definitions (${TARGET} PUBLIC __STDC_CONSTANT_MACROS )
4652 target_link_libraries (${TARGET} PRIVATE Threads::Threads PUBLIC FFmpeg::FFmpeg )
You can’t perform that action at this time.
0 commit comments