Compatibility with CMake 3.5

This commit is contained in:
Jean Pierre Cimalando 2020-01-31 23:24:22 +01:00
parent b9294e9e54
commit 8b7bba682c
2 changed files with 18 additions and 3 deletions

View file

@ -2,7 +2,10 @@ if(WIN32)
cmake_minimum_required (VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
else()
cmake_minimum_required (VERSION 3.11)
cmake_minimum_required (VERSION 3.5)
if (POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()
endif()
project (sfizz VERSION 0.2.0 LANGUAGES CXX C)
set(PROJECT_DESCRIPTION "A library to load SFZ description files and use them to render music.")

View file

@ -1,9 +1,21 @@
# Added in CMake 3.9
if (CMAKE_VERSION VERSION_LESS 3.9)
message (WARNING "\nIPO checks are only available on CMake 3.9 and later.")
set(ENABLE_LTO OFF CACHE BOOL "" FORCE)
function (SFIZZ_ENABLE_LTO_IF_NEEDED TARGET)
endfunction()
return()
endif()
include (CheckIPOSupported)
check_ipo_supported (RESULT result OUTPUT output)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
set(ENABLE_LTO OFF)
set(ENABLE_LTO OFF CACHE BOOL "" FORCE)
endif()
if (result AND ENABLE_LTO AND CMAKE_BUILD_TYPE STREQUAL "Release")
@ -14,7 +26,7 @@ else()
else()
message (WARNING "\nIPO was disabled or not in a Release build.")
endif()
set (ENABLE_LTO OFF)
set(ENABLE_LTO OFF CACHE BOOL "" FORCE)
endif()
function (SFIZZ_ENABLE_LTO_IF_NEEDED TARGET)