shithub: libsamplerate

Download patch

ref: f42f97f3312e342568f8d3cb432e44944e9768b5
parent: 29b0b173de4e3a9841db98526b8621d9bb88f0d8
author: robiwan <robert.bielik@dirac.se>
date: Thu Oct 4 08:47:17 EDT 2018

CMake: Allow tests and install to be enabled/disabled

The default when building standalone is enabled.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,9 @@
 cmake_minimum_required(VERSION 3.1)
 project(libsamplerate VERSION 0.1.9 LANGUAGES C)
 
+option(LIBSAMPLERATE_TESTS "Enable to generate test targets" ON)
+option(LIBSAMPLERATE_INSTALL "Enable to add install directives" ON)
+
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
 
 include(TestBigEndian)
@@ -84,7 +87,9 @@
 
 target_include_directories(samplerate PUBLIC
 	${PROJECT_SOURCE_DIR}/src
-	${CMAKE_CURRENT_BINARY_DIR})
+    ${CMAKE_CURRENT_BINARY_DIR})
+    
+if(LIBSAMPLERATE_TESTS)
 
 enable_testing()
 
@@ -126,7 +131,9 @@
 		target_link_libraries (${exampleName} PUBLIC  "-framework CoreAudio")
 	endif()
 endforeach(exampleSrc)
+endif() 
 
+if(LIBSAMPLERATE_INSTALL)
 set(prefix ${CMAKE_INSTALL_PREFIX})
 set(exec_prefix "\${prefix}")
 set(includedir "\${prefix}/include")
@@ -141,3 +148,5 @@
 install(FILES src/samplerate.h DESTINATION include)
 install(DIRECTORY doc/ DESTINATION share/doc/libsamplerate)
 install(FILES ${CMAKE_BINARY_DIR}/samplerate.pc DESTINATION lib/pkgconfig)
+
+endif()