diff options
-rw-r--r-- | CMakeLists.txt | 12 |
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() + |