Skip to content

Commit

Permalink
Revert "Move more compiler options to DESKTOP_APP_SPECIAL_TARGET cond…
Browse files Browse the repository at this point in the history
…ition"

This reverts commit 3225787.
  • Loading branch information
ilya-fedin authored and john-preston committed Oct 1, 2022
1 parent 0d27a76 commit 6f96a68
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 46 deletions.
62 changes: 32 additions & 30 deletions options_linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,32 @@

target_compile_options(common_options
INTERFACE
$<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
$<IF:$<CONFIG:Debug>,,-fno-strict-aliasing>
)

target_compile_options_if_exists(common_options
INTERFACE
-fstack-protector-all
-fstack-clash-protection
-fPIC
-pipe
-Wall
-Wextra
-Wno-unused-parameter
-Wno-switch
-Wno-maybe-uninitialized
-Wno-missing-field-initializers
-Wno-sign-compare
-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
Expand All @@ -20,40 +41,17 @@ INTERFACE
if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_options(common_options
INTERFACE
$<$<NOT:$<CONFIG:Debug>>:-Ofast>
$<$<NOT:$<CONFIG:Debug>>:-g>
$<$<NOT:$<CONFIG:Debug>>:-flto>
)
target_compile_options_if_exists(common_options
INTERFACE
-fstack-protector-all
-fstack-clash-protection
-pipe
-Wall
$<IF:$<CONFIG:Debug>,,-Ofast>
-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
$<$<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
$<IF:$<CONFIG:Debug>,,-Ofast>
)

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)
Expand All @@ -77,6 +75,10 @@ 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()

Expand Down
25 changes: 13 additions & 12 deletions options_mac.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@ 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()

Expand Down
4 changes: 0 additions & 4 deletions variables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ 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 AND NOT DEFINED DESKTOP_APP_MAC_ARCH)
if (DEFINED CMAKE_OSX_ARCHITECTURES)
set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.")
Expand Down

0 comments on commit 6f96a68

Please sign in to comment.