Navigation Menu

Skip to content

Commit

Permalink
cmake: use CMAKE_INTERPROCEDURAL_OPTIMIZATION for LTO
Browse files Browse the repository at this point in the history
  • Loading branch information
aberaud committed Oct 27, 2018
1 parent a3768d1 commit b7b5152
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required (VERSION 3.1)
project (opendht)
cmake_policy (SET CMP0069 NEW)
set (opendht_VERSION_MAJOR 1)
set (opendht_VERSION_MINOR 7.4)
set (opendht_VERSION ${opendht_VERSION_MAJOR}.${opendht_VERSION_MINOR})
Expand Down Expand Up @@ -81,13 +82,7 @@ else ()
add_definitions(-DOPENDHT_LOG=false)
endif()
if (OPENDHT_LTO)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-linker-plugin")
set (CMAKE_AR "gcc-ar")
set (CMAKE_NM "gcc-nm")
set (CMAKE_RANLIB "gcc-ranlib")
endif ()
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()

if (MSGPACK_INCLUDE_DIRS)
Expand Down Expand Up @@ -246,9 +241,6 @@ if (OPENDHT_STATIC)
${opendht_HEADERS}
)
set_target_properties (opendht-static PROPERTIES OUTPUT_NAME "opendht")
if (OPENDHT_LTO)
set_property(TARGET opendht-static APPEND_STRING PROPERTY LINK_FLAGS "-flto -fuse-linker-plugin")
endif ()
if (OPENDHT_ARGON2)
target_include_directories(opendht-static SYSTEM PRIVATE argon2)
else ()
Expand All @@ -268,9 +260,6 @@ if (OPENDHT_SHARED)
set_target_properties (opendht PROPERTIES IMPORT_SUFFIX "_import.lib")
set_target_properties (opendht PROPERTIES SOVERSION ${opendht_VERSION_MAJOR} VERSION ${opendht_VERSION})
target_compile_definitions(opendht PRIVATE OPENDHT_BUILD)
if (OPENDHT_LTO)
set_property(TARGET opendht APPEND_STRING PROPERTY LINK_FLAGS -flto -fuse-linker-plugin)
endif ()
if (OPENDHT_ARGON2)
target_include_directories(opendht SYSTEM PRIVATE argon2)
else ()
Expand Down

0 comments on commit b7b5152

Please sign in to comment.