From e0c38060457ea1639a3582dd8de6fa027ba2b964 Mon Sep 17 00:00:00 2001 From: Alex Brinkman Date: Sun, 14 Feb 2021 09:22:48 -0800 Subject: [PATCH] improved logic around BUILD_TESTS --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee408f9..8d4e267 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,13 @@ endif() set(SOEM_INCLUDE_INSTALL_DIR include/soem) set(SOEM_LIB_INSTALL_DIR lib) -set(BUILD_TESTS TRUE) + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(BUILD_TESTS TRUE) +else() + message(STATUS "SOEM: not building tests when built as dependency") + set(BUILD_TESTS FALSE) +endif() if(WIN32) set(OS "win32")