Merge pull request #35 from jpcima/cmake-compat
Compatibility with CMake 3.5
This commit is contained in:
commit
3be59cef92
3 changed files with 24 additions and 7 deletions
|
|
@ -2,7 +2,10 @@ if(WIN32)
|
||||||
cmake_minimum_required (VERSION 3.15)
|
cmake_minimum_required (VERSION 3.15)
|
||||||
cmake_policy(SET CMP0091 NEW)
|
cmake_policy(SET CMP0091 NEW)
|
||||||
else()
|
else()
|
||||||
cmake_minimum_required (VERSION 3.11)
|
cmake_minimum_required (VERSION 3.5)
|
||||||
|
if (POLICY CMP0069)
|
||||||
|
cmake_policy(SET CMP0069 NEW)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
project (sfizz VERSION 0.2.0 LANGUAGES CXX C)
|
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.")
|
set(PROJECT_DESCRIPTION "A library to load SFZ description files and use them to render music.")
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
# Added in CMake 3.9
|
# 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)
|
include (CheckIPOSupported)
|
||||||
check_ipo_supported (RESULT result OUTPUT output)
|
check_ipo_supported (RESULT result OUTPUT output)
|
||||||
|
|
||||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
|
if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
|
||||||
set(ENABLE_LTO OFF)
|
set(ENABLE_LTO OFF CACHE BOOL "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (result AND ENABLE_LTO AND CMAKE_BUILD_TYPE STREQUAL "Release")
|
if (result AND ENABLE_LTO AND CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
|
@ -14,7 +26,7 @@ else()
|
||||||
else()
|
else()
|
||||||
message (WARNING "\nIPO was disabled or not in a Release build.")
|
message (WARNING "\nIPO was disabled or not in a Release build.")
|
||||||
endif()
|
endif()
|
||||||
set (ENABLE_LTO OFF)
|
set(ENABLE_LTO OFF CACHE BOOL "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function (SFIZZ_ENABLE_LTO_IF_NEEDED TARGET)
|
function (SFIZZ_ENABLE_LTO_IF_NEEDED TARGET)
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,12 @@ endfunction(SFIZZ_LINK_LIBSNDFILE)
|
||||||
# If we build with Clang use libc++
|
# If we build with Clang use libc++
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID)
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID)
|
||||||
set(USE_LIBCPP ON CACHE BOOL "Use libc++ with clang")
|
set(USE_LIBCPP ON CACHE BOOL "Use libc++ with clang")
|
||||||
add_compile_options(-stdlib=libc++)
|
if (USE_LIBCPP)
|
||||||
# Presumably need the above for linking too, maybe other options missing as well
|
add_compile_options(-stdlib=libc++)
|
||||||
add_link_options(-stdlib=libc++) # New command on CMake master, not in 3.12 release
|
# Presumably need the above for linking too, maybe other options missing as well
|
||||||
add_link_options(-lc++abi) # New command on CMake master, not in 3.12 release
|
add_link_options(-stdlib=libc++) # New command on CMake master, not in 3.12 release
|
||||||
|
add_link_options(-lc++abi) # New command on CMake master, not in 3.12 release
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Don't show build information when building a different project
|
# Don't show build information when building a different project
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue