summaryrefslogtreecommitdiffstats
path: root/cmake/QtInternalTargets.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-08-18 11:38:40 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-08-19 18:26:00 +0200
commit41800c3c31517aab387962e5b60aaa942ac516e2 (patch)
treead67eca48e3691c130e57f1073c6c4cc51d831e3 /cmake/QtInternalTargets.cmake
parentcb1600145b7086388c5e5ca0292629ade9d1da58 (diff)
CMake: Add /OPT:REF flag when building Qt on Windows
In qmake it's done for all qmake projects, in CMake we lean on the safe side and apply it to building Qt itself. User CMake projects can then choose to add it themselves. Task-number: QTBUG-85992 Change-Id: I51919f947d43ffd9925e3d2837dcad17e480367d Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'cmake/QtInternalTargets.cmake')
-rw-r--r--cmake/QtInternalTargets.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake
index c616d76bb7..bd3d034f60 100644
--- a/cmake/QtInternalTargets.cmake
+++ b/cmake/QtInternalTargets.cmake
@@ -115,6 +115,13 @@ endif()
target_compile_definitions(PlatformCommonInternal INTERFACE $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
+if(MSVC)
+ # To mimic mkspecs/common/msvc-desktop.conf add optimization flag for non-debug configs.
+ # In qmake, the flag is added to any user project built with qmake. In CMake land, to be on the
+ # safe side, only add when building Qt itself.
+ target_link_options(PlatformCommonInternal INTERFACE "$<$<NOT:$<CONFIG:Debug>>:/OPT:REF>")
+endif()
+
function(qt_internal_apply_bitcode_flags target)
# See mkspecs/features/uikit/bitcode.prf
set(release_flags "-fembed-bitcode")