mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
cmake: enable link time optimizations
This commit is contained in:
parent
db096e7e97
commit
d20363e244
1 changed files with 15 additions and 1 deletions
|
@ -99,7 +99,6 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
|
|||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -shared-libsan")
|
||||
endif()
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,error")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-undefined,error")
|
||||
|
@ -125,6 +124,21 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0069)
|
||||
if(NOT USE_CLANG_TIDY) # clang-tidy + GCC + LTO = errors
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT IPO_SUPPORTED)
|
||||
message(STATUS "Link time optimization: ${IPO_SUPPORTED}")
|
||||
if(IPO_SUPPORTED)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(LIBSUPERDERPY_STATIC "Compile and link libsuperderpy as a static library." OFF)
|
||||
|
||||
option(LIBSUPERDERPY_STATIC_DEPS "Link dependencies (e.g. Allegro) statically." OFF)
|
||||
|
|
Loading…
Reference in a new issue