mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Use -fno-c++-static-destructors
Static destructors cause the destructor for a global object to run when the program exits. They are bad because: 1. Registering them takes time and memory at startup 2. Running them takes time at shutdown and also they may have weird interactions. This shaves about 12k off of the binary size. Unfortunately gcc does not support this flag.
This commit is contained in:
parent
448dd18685
commit
793aff3891
1 changed files with 7 additions and 0 deletions
|
@ -31,6 +31,13 @@ if (HAS_REDUNDANT_MOVE)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wredundant-move")
|
||||
endif()
|
||||
|
||||
# Disable static destructors if we can.
|
||||
check_cxx_compiler_flag("-fno-c++-static-destructors" DISABLE_STATIC_DESTRUCTORS)
|
||||
if (DISABLE_STATIC_DESTRUCTORS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-c++-static-destructors")
|
||||
endif()
|
||||
|
||||
|
||||
# Try using CMake's own logic to locate curses/ncurses
|
||||
find_package(Curses)
|
||||
if(NOT ${CURSES_FOUND})
|
||||
|
|
Loading…
Reference in a new issue