From 053e98689130f21bba4125eb946d196403859b3d Mon Sep 17 00:00:00 2001 From: przemek83 <4788832+przemek83@users.noreply.github.com> Date: Sun, 8 Dec 2024 13:51:52 +0100 Subject: [PATCH] Compile examples and tests only when compiling library directly. Skip otherwise. --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89fe5ff..41f309a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,11 @@ else() target_link_libraries(${PROJECT_NAME} PUBLIC qwt) endif() -add_subdirectory(examples) +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + add_subdirectory(examples) +endif() -enable_testing() -add_subdirectory(tests) +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + enable_testing() + add_subdirectory(tests) +endif()