# Allows FluidSynth to build with position-independent code enabled when building FluidSynth as a static library. --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,9 +127,9 @@ set(CMAKE_CXX_EXTENSIONS OFF) # Compile with position independent code if the user requested a shared lib, i.e. no PIC if static requested. # This is cmakes default behavior, but here it's explicitly required due to the use of libfluidsynth-OBJ as object library, # which would otherwise always be compiled without PIC. -if ( NOT CMAKE_POSITION_INDEPENDENT_CODE ) - set ( CMAKE_POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} ) -endif ( NOT CMAKE_POSITION_INDEPENDENT_CODE ) + + + # the default global visibility level for all target # no visibility support on OS2 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -265,7 +265,7 @@ generate_product_version( ) endif ( WIN32 ) -add_library ( libfluidsynth-OBJ OBJECT +add_library ( libfluidsynth STATIC ${config_SOURCES} ${fluid_alsa_SOURCES} ${fluid_aufile_SOURCES} @@ -291,15 +291,15 @@ add_library ( libfluidsynth-OBJ OBJECT ${public_main_HEADER} ${VersionFilesOutputVariable} ) - +add_library ( libfluidsynth-OBJ ALIAS libfluidsynth ) if ( LIBFLUID_CPPFLAGS ) - set_target_properties ( libfluidsynth-OBJ + set_target_properties ( libfluidsynth PROPERTIES COMPILE_FLAGS ${LIBFLUID_CPPFLAGS} ) endif ( LIBFLUID_CPPFLAGS ) # note: by default this target creates a shared object (or dll). To build a # static library instead, set the option BUILD_SHARED_LIBS to FALSE. -add_library ( libfluidsynth $ ) + if ( MACOSX_FRAMEWORK ) set_property ( SOURCE ${public_HEADERS} @@ -422,4 +422,4 @@ ExternalProject_Add(gentables "${CMAKE_COMMAND}" --build "${GENTAB_BDIR}" INSTALL_COMMAND ${GENTAB_BDIR}/make_tables.exe "${CMAKE_BINARY_DIR}/" ) -add_dependencies(libfluidsynth-OBJ gentables) +add_dependencies(libfluidsynth gentables)