Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfierz <bfierz@users.noreply.github.com>2017-09-07 03:50:30 +0300
committerNeil MacIntosh <neilmac@microsoft.com>2017-09-07 03:50:30 +0300
commitb01450878b39307df9abb702f02ce8c1d6c9ee30 (patch)
treee9613d60767385c19e75eab479ffe106a2f04bed /CMakeLists.txt
parent77e081e88b2a31f803a4e0b5675c79044f97338b (diff)
Adds an option to disable test generation (#552)
When integrating the GSL as an external dependency, it is usually unnecessary to build and run the unit-tests.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 11 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 986d948..53058e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,12 @@ find_package(Git)
# creates a library GSL which is an interface (header files only)
add_library(GSL INTERFACE)
+# determine whether this is a standalone project or included by other projects
+set(GSL_STANDALONE_PROJECT OFF)
+if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
+ set(GSL_STANDALONE_PROJECT ON)
+endif ()
+
# when minimum version required is 3.8.0 remove if below
# both branches do exactly the same thing
if (CMAKE_MAJOR_VERSION VERSION_LESS 3.7.9)
@@ -53,5 +59,8 @@ install(
DESTINATION include
)
-enable_testing()
-add_subdirectory(tests)
+option(GSL_TEST "Generate tests." ${GSL_STANDALONE_PROJECT})
+if (GSL_TEST)
+ enable_testing()
+ add_subdirectory(tests)
+endif ()