Move more compiler options to DESKTOP_APP_SPECIAL_TARGET condition
This commit is contained in:
parent
84f43a8252
commit
32257877e0
3 changed files with 44 additions and 42 deletions
|
|
@ -6,28 +6,11 @@
|
|||
|
||||
target_compile_options_if_exists(common_options
|
||||
INTERFACE
|
||||
-fstack-protector-all
|
||||
-fstack-clash-protection
|
||||
-fPIC
|
||||
$<IF:$<CONFIG:Debug>,,-fno-strict-aliasing>
|
||||
-pipe
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
-Wno-switch
|
||||
-Wno-maybe-uninitialized
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-sign-compare
|
||||
$<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
|
||||
-Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20
|
||||
-Wno-deprecated-declarations # TODO: Remove when there will be no Qt 5 support
|
||||
)
|
||||
|
||||
target_compile_definitions(common_options
|
||||
INTERFACE
|
||||
$<IF:$<CONFIG:Debug>,,_FORTIFY_SOURCE=2>
|
||||
_GLIBCXX_ASSERTIONS
|
||||
)
|
||||
|
||||
target_link_options_if_exists(common_options
|
||||
INTERFACE
|
||||
-pthread
|
||||
|
|
@ -35,19 +18,39 @@ INTERFACE
|
|||
)
|
||||
|
||||
if (DESKTOP_APP_SPECIAL_TARGET)
|
||||
target_compile_options(common_options
|
||||
target_compile_options_if_exists(common_options
|
||||
INTERFACE
|
||||
$<IF:$<CONFIG:Debug>,,-Ofast>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-Ofast>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-g>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-flto>
|
||||
-fstack-protector-all
|
||||
-fstack-clash-protection
|
||||
-pipe
|
||||
-Wall
|
||||
-Werror
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
-Wno-switch
|
||||
-Wno-maybe-uninitialized
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-sign-compare
|
||||
)
|
||||
target_compile_definitions(common_options
|
||||
INTERFACE
|
||||
$<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=2>
|
||||
_GLIBCXX_ASSERTIONS
|
||||
)
|
||||
|
||||
target_link_options(common_options
|
||||
INTERFACE
|
||||
$<IF:$<CONFIG:Debug>,,-Ofast>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-Ofast>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-g>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-flto>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-fuse-linker-plugin>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-fwhole-program>
|
||||
-Wl,-z,relro
|
||||
-Wl,-z,now
|
||||
# -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601
|
||||
)
|
||||
|
||||
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto>)
|
||||
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>)
|
||||
endif()
|
||||
|
||||
if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||
|
|
@ -71,10 +74,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
|
|||
target_link_options(common_options
|
||||
INTERFACE
|
||||
-rdynamic
|
||||
-fwhole-program
|
||||
-Wl,-z,relro
|
||||
-Wl,-z,now
|
||||
# -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -20,30 +20,29 @@ endif()
|
|||
|
||||
target_compile_options(common_options
|
||||
INTERFACE
|
||||
-pipe
|
||||
-Wall
|
||||
-Wextra
|
||||
-fPIE
|
||||
$<$<COMPILE_LANGUAGE:OBJC,OBJCXX>:-fobjc-weak>
|
||||
-fvisibility-inlines-hidden
|
||||
-fvisibility=hidden
|
||||
-Wno-deprecated-declarations # temp for range-v3
|
||||
-Wno-unused-variable
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
-Wno-switch
|
||||
-Wno-comment
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-sign-compare
|
||||
-Wno-unknown-attributes
|
||||
-Wno-pragma-system-header-outside-header
|
||||
)
|
||||
|
||||
if (DESKTOP_APP_SPECIAL_TARGET)
|
||||
target_compile_options(common_options
|
||||
INTERFACE
|
||||
-pipe
|
||||
-g
|
||||
-Wall
|
||||
-Werror
|
||||
-Wextra
|
||||
-Wno-unused-variable
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
-Wno-switch
|
||||
-Wno-comment
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-sign-compare
|
||||
-Wno-unknown-attributes
|
||||
-Wno-pragma-system-header-outside-header
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled H
|
|||
cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF)
|
||||
cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF)
|
||||
|
||||
if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES)
|
||||
set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue