1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 17:11:12 +02:00

Enable Interprocedural Optimization

CMake will now enable linking IPO if the compiler supports it

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
Emily Mabrey
2021-08-22 11:00:13 -04:00
parent 80cc3f2ff2
commit b650b5aafc
4 changed files with 22 additions and 11 deletions

View File

@@ -156,11 +156,6 @@ set( CMAKE_PREFIX_PATH
${CMAKE_PREFIX_PATH}
)
# This "is a good thing" but greatly increases link time on Linux
#set( CMAKE_INTERPROCEDURAL_OPTIMIZATION ON )
#set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON )
#set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF )
# Set the required C++ standard
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
@@ -169,6 +164,20 @@ include( CMakeDependentOption )
project( Tenacity )
#This must appear after the project declaration so it can detect ENABLED_LANGUAGES
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_OUTPUT)
mark_as_advanced( FORCE IPO_SUPPORTED )
if(IPO_SUPPORTED)
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION ON )
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON )
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF )
add_definitions( -DHAVE_IPO )
message(STATUS "Interprocedural optimization is supported")
else()
message(STATUS "Interprocedural optimization is not supported: ${IPO_OUTPUT}")
endif()
# Use ccache if available
find_program( CCACHE_PROGRAM ccache )
mark_as_advanced( FORCE CCACHE_PROGRAM )