From 1be4a16ec6db0708291758afd080905ba7d48849 Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 28 Jan 2018 16:07:41 -0600 Subject: [PATCH] CMake: enable interprocedural optimization --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5789119a..d70790f44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,8 @@ ## Author: Hank Anderson ## -cmake_minimum_required(VERSION 2.8.5) +cmake_minimum_required(VERSION 3.9) # CMP0069 NEW +include(CheckIPOSupported) project(OpenBLAS C ASM) set(OpenBLAS_MAJOR_VERSION 0) set(OpenBLAS_MINOR_VERSION 3) @@ -147,6 +148,12 @@ endif() # add objects to the openblas lib add_library(${OpenBLAS_LIBNAME} ${LA_SOURCES} ${LAPACKE_SOURCES} ${RELA_SOURCES} ${TARGET_OBJS} ${OpenBLAS_DEF_FILE}) +check_ipo_supported(RESULT IPO_SUPPORTED) +if(IPO_SUPPORTED) + message(STATUS "Building with link-time code generation") + set_property(TARGET ${OpenBLAS_LIBNAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) +endif() + # Android needs to explicitly link against libm if(ANDROID) target_link_libraries(${OpenBLAS_LIBNAME} m)