diff --git a/CMakeLists.txt b/CMakeLists.txt index aa4cc31..edcbe33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,12 @@ cmake_minimum_required(VERSION 3.11) project(tl-function_ref VERSION 1.0.0 LANGUAGES CXX) -option(FUNCTION_REF_ENABLE_TESTS "Enable tests." ON) +get_directory_property(is_subproject PARENT_DIRECTORY) +if(NOT is_subproject) + set(is_mainproject YES) +endif() + +option(FUNCTION_REF_ENABLE_TESTS "Enable tests." ${is_mainproject}) include(FetchContent) FetchContent_Declare( @@ -37,4 +42,4 @@ if(FUNCTION_REF_ENABLE_TESTS) target_link_libraries(tests Catch function-ref) set_property(TARGET tests PROPERTY CXX_STANDARD 14) -endif() \ No newline at end of file +endif()