History

CMake: Allow tests and install to be enabled/disabled

The default when building standalone is enabled.

robiwan committed 8 years ago

Commit f42f97f1 parent 29b0b171 file · +10 −1Browse files

Unified · Split

CMakeLists.txt+10−1
@@ -1,6 +1,9 @@
11 cmake_minimum_required(VERSION 3.1)
22 project(libsamplerate VERSION 0.1.9 LANGUAGES C)
33
4+option(LIBSAMPLERATE_TESTS "Enable to generate test targets" ON)
5+option(LIBSAMPLERATE_INSTALL "Enable to add install directives" ON)
6+
47 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
58
69 include(TestBigEndian)
@@ -84,7 +87,9 @@ endif() · 77 unmodified lines
8487
8588 target_include_directories(samplerate PUBLIC
8689 ${PROJECT_SOURCE_DIR}/src
87− ${CMAKE_CURRENT_BINARY_DIR})
90+ ${CMAKE_CURRENT_BINARY_DIR})
91+
92+if(LIBSAMPLERATE_TESTS)
8893
8994 enable_testing()
9095
@@ -126,7 +131,9 @@ foreach(exampleSrc ${EXAMPLE_SRCS}) · 35 unmodified lines
126131 target_link_libraries (${exampleName} PUBLIC "-framework CoreAudio")
127132 endif()
128133 endforeach(exampleSrc)
134+endif()
129135
136+if(LIBSAMPLERATE_INSTALL)
130137 set(prefix ${CMAKE_INSTALL_PREFIX})
131138 set(exec_prefix "\${prefix}")
132139 set(includedir "\${prefix}/include")
@@ -141,3 +148,5 @@ install(TARGETS samplerate DESTINATION lib) · 8 unmodified lines
141148 install(FILES src/samplerate.h DESTINATION include)
142149 install(DIRECTORY doc/ DESTINATION share/doc/libsamplerate)
143150 install(FILES ${CMAKE_BINARY_DIR}/samplerate.pc DESTINATION lib/pkgconfig)
151+
152+endif()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t