From de9601d8715b0e5a23f01e0c79e801859e6790df Mon Sep 17 00:00:00 2001 From: Marcel Jacobse <44684927+mjacobse@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:05:37 +0100 Subject: [PATCH] Allow old CMake versions without IPO support --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d4b65e..899d057 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,10 @@ endif() if (${CMAKE_VERSION} VERSION_GREATER "3.15.0") cmake_policy(SET CMP0091 NEW) endif() -cmake_policy(SET CMP0069 NEW) -set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) +if (NOT ${CMAKE_VERSION} VERSION_LESS "3.9.0") + cmake_policy(SET CMP0069 NEW) + set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) +endif() project(ASL) cmake_minimum_required(VERSION 3.0) @@ -38,7 +40,11 @@ option(BUILD_DYNRT_LIBS "Build the libraries linked against the dynamic runtime option(BUILD_MT_LIBS "Build the multithreaded library" OFF) option(BUILD_CPP "Build the cpp interface" OFF) option(BUILD_F2C "Build the f2c library" OFF) -option(USE_LTO "Use link time optimization" ON) +if (${CMAKE_VERSION} VERSION_LESS "3.9.0") + option(USE_LTO "Use link time optimization" OFF) +else() + option(USE_LTO "Use link time optimization" ON) +endif() if(NOT BUILD_ASL_EXAMPLES) option(BUILD_ASL_EXAMPLES "Build the examples" OFF)