CMake: 3.13 as minimum for non Windows platforms, plus minor fixes

This commit is contained in:
redtide 2023-05-23 12:27:31 +02:00
parent 206786447e
commit 899e988c8c
No known key found for this signature in database
3 changed files with 12 additions and 5 deletions

View file

@ -2,7 +2,8 @@ if(WIN32)
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
else()
cmake_minimum_required(VERSION 3.12)
# USE_LIBCPP requires add_link_options() in SfizzConfig.cmake
cmake_minimum_required(VERSION 3.13)
endif()
project(libsfizz

View file

@ -117,15 +117,16 @@ cmake_dependent_option(USE_LIBCPP "Use libc++ with clang" "${APPLE}"
"CMAKE_CXX_COMPILER_ID MATCHES Clang" OFF)
if(USE_LIBCPP)
add_compile_options(-stdlib=libc++)
# Presumably need the above for linking too, maybe other options missing as well
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
add_link_options(-stdlib=libc++) # New command in CMake 3.13
add_link_options(-lc++abi)
endif()
include(GNUInstallDirs)
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(PROJECT_IS_MAIN TRUE)
else()
set(PROJECT_IS_MAIN FALSE)
endif()
# Don't show build information when building a different project

View file

@ -330,7 +330,12 @@ if(SFIZZ_SHARED)
target_include_directories(sfizz_shared PUBLIC .)
target_link_libraries(sfizz_shared PRIVATE sfizz::internal)
target_compile_definitions(sfizz_shared PRIVATE SFIZZ_EXPORT_SYMBOLS)
set_target_properties(sfizz_shared PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}" OUTPUT_NAME "sfizz" PUBLIC_HEADER "sfizz.h;sfizz.hpp;sfizz_message.h")
set_target_properties(sfizz_shared PROPERTIES
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}"
OUTPUT_NAME "sfizz"
PUBLIC_HEADER "sfizz.h;sfizz.hpp;sfizz_message.h"
)
sfizz_enable_lto_if_needed(sfizz_shared)
if(NOT MSVC)