enable tests and examples only if is top project
This commit is contained in:
parent
513240b698
commit
e4b501153c
1 changed files with 8 additions and 2 deletions
|
@ -2,8 +2,14 @@
|
||||||
|
|
||||||
project(nameof VERSION "0.8.0" LANGUAGES CXX)
|
project(nameof VERSION "0.8.0" LANGUAGES CXX)
|
||||||
|
|
||||||
option(NAMEOF_OPT_BUILD_EXAMPLES "Build nameof examples" ON)
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||||
option(NAMEOF_OPT_BUILD_TESTS "Build and perform nameof tests" ON)
|
set(IS_TOPLEVEL_PROJECT TRUE)
|
||||||
|
else()
|
||||||
|
set(IS_TOPLEVEL_PROJECT FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(NAMEOF_OPT_BUILD_EXAMPLES "Build nameof examples" ${IS_TOPLEVEL_PROJECT})
|
||||||
|
option(NAMEOF_OPT_BUILD_TESTS "Build and perform nameof tests" ${IS_TOPLEVEL_PROJECT})
|
||||||
|
|
||||||
if(NAMEOF_OPT_BUILD_EXAMPLES)
|
if(NAMEOF_OPT_BUILD_EXAMPLES)
|
||||||
add_subdirectory(example)
|
add_subdirectory(example)
|
||||||
|
|
Loading…
Reference in a new issue