From 953df138c0782060f387f82f80adfe46a360cf98 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Fri, 16 Sep 2022 20:45:59 +0200 Subject: [PATCH] CMake: Automatically build tests during standalone compilation --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 509faa1..181f274 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,13 @@ # Set project name set(PROJECT "ruc") -option(RUC_BUILD_TESTS "Build the RUC test programs" ON) +if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(RUC_STANDALONE TRUE) +endif() + # Options option(BUILD_SHARED_LIBS "Build shared libraries" OFF) -option(RUC_BUILD_TESTS "Build the RUC test programs" OFF) +option(RUC_BUILD_TESTS "Build the RUC test programs" ${RUC_STANDALONE}) # ------------------------------------------