CMake: Add -fPIC also for OBJECT libraries

add_qtc_library would have set the POSITION_INDEPENDENT_CODE property
for STATIC libraries on UNIX based systems.

The OBJECT libraries need the same treatment.

Change-Id: Ia333a36ea0f35d7db3ed876cdde5b895b47644c7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2023-05-12 13:18:35 +02:00
parent fc8ae0e2dc
commit 0dbc208a07
3 changed files with 2 additions and 3 deletions

View File

@@ -188,7 +188,7 @@ function(add_qtc_library name)
set(TEST_DEFINES WITH_TESTS SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if(_arg_STATIC AND UNIX)
if((_arg_STATIC OR _arg_OBJECT) AND UNIX)
# not added by Qt if reduce_relocations is turned off for it
set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()

View File

@@ -41,7 +41,6 @@ add_qtc_library(3rd_cplusplus OBJECT
TypeVisitor.cpp TypeVisitor.h
cppassert.h
SKIP_PCH
PROPERTIES POSITION_INDEPENDENT_CODE ON
)
set(export_symbol_declaration DEFINES CPLUSPLUS_BUILD_LIB)

View File

@@ -1,5 +1,5 @@
add_qtc_library(SqliteC OBJECT
PROPERTIES AUTOMOC OFF AUTOUIC OFF QT_COMPILE_OPTIONS_DISABLE_WARNINGS ON POSITION_INDEPENDENT_CODE ON
PROPERTIES AUTOMOC OFF AUTOUIC OFF QT_COMPILE_OPTIONS_DISABLE_WARNINGS ON
DEFINES SQLITE_CORE SQLITE_CUSTOM_INCLUDE=config.h $<$<CONFIG:Debug>:SQLITE_DEBUG>
PROPERTIES COMPILE_OPTIONS $<IF:$<CXX_COMPILER_ID:MSVC>,/FIconfig.h,-includeconfig.h>
PUBLIC_INCLUDES