diff --git a/CMakeLists.txt b/CMakeLists.txt index 8920fd6f..c4cec497 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/cmake/SfizzConfig.cmake b/cmake/SfizzConfig.cmake index a17feae1..f2ebcead 100644 --- a/cmake/SfizzConfig.cmake +++ b/cmake/SfizzConfig.cmake @@ -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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 168da406..4d97665a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)