From 89b04b4221f6bc13878ebebc7b92c8bc50a45f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20L=C3=B3pez-Cabanillas?= Date: Sat, 24 Sep 2022 16:06:07 +0200 Subject: [PATCH 1/4] fix for issue #42: new cmake option for PIC Explicit cmake option for CMAKE_POSITION_INDEPENDENT_CODE initialized by default to TRUE. Users can set it to FALSE in the cmake command line when needed. closes #42 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8078398..9e39803 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ include(GNUInstallDirs) option(ENABLE_SF3 "Enable SF3 files (ogg/vorbis compressed samples)" FALSE) option(STB_VORBIS "Use STB VORBIS library instead of ogg/vorbis" FALSE) option(WITH_FLOAT "Use 32 bit float type samples (instead of 64 bit double type)" TRUE) +option(CMAKE_POSITION_INDEPENDENT_CODE "Use PIC for building all sources" TRUE) string(TOLOWER "${CMAKE_BUILD_TYPE}" LOWERCASE_BUILD_TYPE) if("${LOWERCASE_BUILD_TYPE}" STREQUAL "debug") @@ -195,7 +196,6 @@ endif() option(FLUIDLITE_BUILD_SHARED "Build shared library" TRUE) if(FLUIDLITE_BUILD_SHARED) - set_target_properties(${PROJECT_NAME}-obj PROPERTIES POSITION_INDEPENDENT_CODE TRUE) add_library(${PROJECT_NAME} SHARED $) target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBVORBIS_LIBRARIES} From 519ccc405b986ac0c797573da50fd005475a6cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20L=C3=B3pez-Cabanillas?= Date: Sat, 24 Sep 2022 16:21:42 +0200 Subject: [PATCH 2/4] create only aliases for existing targets Both the shared and static library targets are optional. Each alias should be created only when the corresponding target is effectively built. --- aliases.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aliases.cmake b/aliases.cmake index c9dde33..0b11113 100644 --- a/aliases.cmake +++ b/aliases.cmake @@ -1,4 +1,8 @@ # The exported targets as aliases, to use FluidLite in another project # for instance as a git submodule -add_library(fluidlite::fluidlite ALIAS fluidlite) -add_library(fluidlite::fluidlite-static ALIAS fluidlite-static) +if (TARGET fluidlite) + add_library(fluidlite::fluidlite ALIAS fluidlite) +endif() +if (TARGET fluidlite-static) + add_library(fluidlite::fluidlite-static ALIAS fluidlite-static) +endif() From 1675f06de3612ea1ff787a3d3fc96784a2afef3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20L=C3=B3pez-Cabanillas?= Date: Thu, 29 Sep 2022 22:10:04 +0200 Subject: [PATCH 3/4] Update README.md Warning for Windows users about symlinks --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3e950e8..8a1ae93 100644 --- a/README.md +++ b/README.md @@ -163,3 +163,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${MATH_LIB} ) ~~~ + +Warning! this repository contains symlinks. If you are a Windows user and this is new for you, please [learn about this feature in Windows](https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/) and [git for windows](/orgs/community/discussions/23591). From 61625264effda539287bab3fbab3f6d229e71dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20L=C3=B3pez-Cabanillas?= Date: Thu, 29 Sep 2022 22:13:03 +0200 Subject: [PATCH 4/4] Fixed link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a1ae93..11c9482 100644 --- a/README.md +++ b/README.md @@ -164,4 +164,4 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ) ~~~ -Warning! this repository contains symlinks. If you are a Windows user and this is new for you, please [learn about this feature in Windows](https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/) and [git for windows](/orgs/community/discussions/23591). +Warning! this repository contains symlinks. If you are a Windows user and this is new for you, please [learn about this feature in Windows](https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/) and [git for windows](https://github.com/orgs/community/discussions/23591).