aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-06-28 18:08:38 +0200
committerHampusM <hampus@hampusmat.com>2022-06-28 18:08:38 +0200
commit0110125215c5b45316b93e42e920fed2e741388a (patch)
tree16ac636f560fe985d1c93fb698b3f0c03eba8663
parent1e60d3ab02dbe7c609237c087575fe0801edf8eb (diff)
build: exclude tests if is subprojectHEADv0.2.1master
-rw-r--r--CMakeLists.txt12
1 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59ed07c..050bf50 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,11 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
+if(DEFINED PROJECT_NAME)
+ set(IS_SUBPROJECT ON)
+else()
+ set(IS_SUBPROJECT OFF)
+endif()
project(yacppdic CXX)
@@ -45,9 +50,14 @@ target_include_directories(${PROJECT_NAME}
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
if(test)
- add_subdirectory(test)
+ if(NOT IS_SUBPROJECT)
+ add_subdirectory(test)
+ else()
+ message(WARNING "Tests excluded because the library is a subproject")
+ endif()
endif()
if(examples)
add_subdirectory(examples/basic)
endif()
+