CMake: make building soundstretch optional

This commit is contained in:
Be 2021-08-21 08:40:53 -05:00 committed by Olli
parent c65afe49f6
commit 3148382fa8

View File

@ -40,9 +40,6 @@ target_compile_options(SoundTouch PRIVATE ${COMPILE_OPTIONS})
if(WIN32 AND BUILD_SHARED_LIBS) if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(SoundTouch PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) set_target_properties(SoundTouch PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if(SOUNDTOUCH_DLL)
target_compile_definitions(SoundTouchDLL PRIVATE DLL_EXPORTS)
endif()
endif() endif()
option(INTEGER_SAMPLES "Use integers instead of floats for samples" OFF) option(INTEGER_SAMPLES "Use integers instead of floats for samples" OFF)
@ -86,6 +83,8 @@ install(TARGETS SoundTouch
####################### #######################
# soundstretch utility # soundstretch utility
option(SOUNDSTRETCH "Build soundstretch command line utility." ON)
if(SOUNDSTRETCH)
add_executable(soundstretch add_executable(soundstretch
source/SoundStretch/main.cpp source/SoundStretch/main.cpp
source/SoundStretch/RunParameters.cpp source/SoundStretch/RunParameters.cpp
@ -99,6 +98,7 @@ target_link_libraries(soundstretch PRIVATE SoundTouch)
install(TARGETS soundstretch install(TARGETS soundstretch
DESTINATION bin DESTINATION bin
) )
endif()
######################## ########################
# SoundTouchDll library # SoundTouchDll library
@ -111,7 +111,6 @@ if(SOUNDTOUCH_DLL)
) )
target_compile_options(SoundTouch PRIVATE -fPIC) target_compile_options(SoundTouch PRIVATE -fPIC)
target_compile_options(SoundTouchDLL PRIVATE -fPIC ${COMPILE_OPTIONS}) target_compile_options(SoundTouchDLL PRIVATE -fPIC ${COMPILE_OPTIONS})
target_compile_definitions(SoundTouchDLL PRIVATE ${COMPILE_DEFINITIONS})
set_target_properties(SoundTouchDLL PROPERTIES CXX_VISIBILITY_PRESET hidden) set_target_properties(SoundTouchDLL PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_include_directories(SoundTouchDLL PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) target_include_directories(SoundTouchDLL PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries(SoundTouchDLL PRIVATE SoundTouch) target_link_libraries(SoundTouchDLL PRIVATE SoundTouch)