Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Copyright (c) 2014-2017, Ruslan Baratov
- # Copyright (c) 2017, David Hirvonen
- # All rights reserved.
- if(DEFINED POLLY_FLAGS_LTO_CMAKE_)
- return()
- else()
- set(POLLY_FLAGS_LTO_CMAKE_ 1)
- endif()
- include(polly_add_cache_flag)
- string(COMPARE EQUAL "${ANDROID_NDK_VERSION}" "" _not_android)
- # TODO: test other platfroms, CMAKE_CXX_FLAGS_INIT should work for all
- if(_not_android)
- polly_add_cache_flag(CMAKE_CXX_FLAGS "-flto")
- polly_add_cache_flag(CMAKE_C_FLAGS "-flto")
- else()
- polly_add_cache_flag(CMAKE_CXX_FLAGS_INIT "-flto")
- polly_add_cache_flag(CMAKE_C_FLAGS_INIT "-flto")
- # SECTIONA
- polly_add_cache_flag(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=gold")
- polly_add_cache_flag(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=gold")
- polly_add_cache_flag(CMAKE_EXE_LINKER_FLAGS_INIT "-flto")
- polly_add_cache_flag(CMAKE_SHARED_LINKER_FLAGS_INIT "-flto")
- # SECTIONB
- polly_add_cache_flag(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-flto")
- polly_add_cache_flag(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-flto")
- polly_add_cache_flag(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-fuse-ld=gold")
- polly_add_cache_flag(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-fuse-ld=gold")
- #polly_add_cache_flag(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-fuse-linker-plugin")
- #polly_add_cache_flag(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-fuse-linker-plugin")
- endif()
- # There is no macro to detect this flags on toolchain calculation so we must
- # mark this toolchain explicitly.
- list(APPEND HUNTER_TOOLCHAIN_UNDETECTABLE_ID "lto")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement