Explorar o código

add link-time optimization for release builds

Julius Pfrommer %!s(int64=10) %!d(string=hai) anos
pai
achega
4f1b2a3250
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      CMakeLists.txt

+ 2 - 0
CMakeLists.txt

@@ -34,6 +34,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
         set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none")
 	endif()
     if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release")
+        add_definitions(-flto)
+        set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -flto")
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s") # strip binary
     endif()
 endif()