shithub: opus

Download patch

ref: c401f21bf1ceab9d811cb6a510926f7609258fc4
parent: 927de8453c502586c03e25c169ec08f2a93ebc02
author: Marcus Asteborg <maastebo@microsoft.com>
date: Fri Mar 13 11:51:10 EDT 2020

cmake - Add option for testing to improve cli

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,7 @@
 option(OPUS_CUSTOM_MODES "Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames"
        OFF)
 option(OPUS_BUILD_PROGRAMS "Build programs" OFF)
+option(OPUS_BUILD_TESTING "Build tests" OFF)
 option(OPUS_FIXED_POINT
        "Compile as fixed-point (for machines without a fast enough FPU)" OFF)
 option(OPUS_ENABLE_FLOAT_API
@@ -45,6 +46,11 @@
   set(OPUS_BUILD_SHARED_LIBRARY ON)
 endif()
 
+if(OPUS_BUILD_TESTING OR BUILD_TESTING)
+  set(OPUS_BUILD_TESTING ON)
+  set(BUILD_TESTING ON)
+endif()
+
 if(OPUS_STACK_PROTECTOR)
   if(NOT MSVC) # GC on by default on MSVC
     check_and_set_flag(STACK_PROTECTION_STRONG -fstack-protector-strong)
@@ -131,6 +137,7 @@
                  "Use alloca for stack arrays (on non-C99 compilers)")
 add_feature_info(CUSTOM_MODES OPUS_CUSTOM_MODES
                  "Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames")
+add_feature_info(BUILD_TESTING OPUS_BUILD_TESTING "Build test programs")
 add_feature_info(BUILD_PROGRAMS OPUS_BUILD_PROGRAMS "Build programs")
 add_feature_info(
   FIXED_POINT OPUS_FIXED_POINT