Simplify per-module option handling

Move flags/options that we use for modules from add_module to the new
platform module target.

Change-Id: I89e414690336dcd37253432fe5116226d1c8dd82
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-06-06 15:09:40 +02:00
parent e7d1ec61e3
commit abe12f600b
2 changed files with 14 additions and 14 deletions

View File

@ -1179,14 +1179,6 @@ function(add_qt_module target)
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
)
if(WIN32)
# Needed for M_PI define. Same as mkspecs/features/qt_module.prf.
# It's set for every module being built, but it's not propagated to user apps.
target_compile_definitions("${target}" PRIVATE _USE_MATH_DEFINES)
endif()
if(FEATURE_largefile)
target_compile_definitions("${target}" PRIVATE "_LARGEFILE64_SOURCE;_LARGEFILE_SOURCE")
endif()
if(NOT ${arg_EXCEPTIONS})
qt_internal_set_no_exceptions_flags("${target}")
endif()
@ -1332,12 +1324,6 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
if(NOT ${arg_DISABLE_TOOLS_EXPORT})
qt_export_tools(${target})
endif()
# We can't use the gold linker on android with the NDK, which is the default
# linker. To build our own target we will use the lld linker.
if (ANDROID)
target_link_options("${target}" PRIVATE -fuse-ld=lld)
endif()
endfunction()
function(qt_export_tools module_name)

View File

@ -67,3 +67,17 @@ if(WARNINGS_ARE_ERRORS)
qt_internal_set_warnings_are_errors_flags(PlatformPluginInternal)
qt_internal_set_warnings_are_errors_flags(PlatformToolInternal)
endif()
if(WIN32)
# Needed for M_PI define. Same as mkspecs/features/qt_module.prf.
# It's set for every module being built, but it's not propagated to user apps.
target_compile_definitions(PlatformModuleInternal INTERFACE _USE_MATH_DEFINES)
endif()
if(FEATURE_largefile)
target_compile_definitions(PlatformModuleInternal INTERFACE "_LARGEFILE64_SOURCE;_LARGEFILE_SOURCE")
endif()
# We can't use the gold linker on android with the NDK, which is the default
# linker. To build our own target we will use the lld linker.
if (ANDROID)
target_link_options(PlatformModuleInternal INTERFACE -fuse-ld=lld)
endif()