From d93f8d8fab3a0140f161a26c3b54717ba9b17bb1 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 11 Mar 2026 17:56:27 +0800 Subject: [PATCH] cmake: skip install code when embedded in other cmake build This is helpful when trying to embed rtaudio in e.g. via CPM/FetchContent. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cee9176..0907da8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Set minimum CMake required version for this project. -cmake_minimum_required(VERSION 3.13 FATAL_ERROR) +cmake_minimum_required(VERSION 3.21 FATAL_ERROR) # Define a C++ project. project(RtAudio LANGUAGES CXX) @@ -306,6 +306,10 @@ endif() string(REPLACE ";" " " apilist "${API_LIST}") message(STATUS "Compiling with support for: ${apilist}") +if(NOT PROJECT_IS_TOP_LEVEL) + return() +endif() + # PkgConfig file string(REPLACE ";" " " req "${PKGCONFIG_REQUIRES}") string(REPLACE ";" " " req_libs "${LIBS_REQUIRES}")