From a12e9fe152565f2e07cd2dbc08d7ea740d22c235 Mon Sep 17 00:00:00 2001 From: Random <35673979+RandomErrorMessage@users.noreply.github.com> Date: Thu, 11 May 2023 09:42:16 -0700 Subject: [PATCH] added options to cmake to disable building docs and tests, default behavior unchanged (#357) --- CMakeLists.txt | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aae3ba2b..8224de93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,7 @@ if (WIN32) add_definitions(-D_CONTAINER_DEBUG_LEVEL=0) endif (NO_ITERATOR_DEBUG) - # TODO: remove these + # TODO: remove these add_compile_definitions(_CRT_SECURE_NO_WARNINGS) if (MSVC) @@ -97,11 +97,6 @@ find_package(TBB REQUIRED) set(TEST_QUAKE_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Quake maps to this directory (useful for testing in game)") set(TEST_QUAKE2_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Quake 2 maps to this directory (useful for testing in game)") -# just creates testmaps.hh with absolute path to the testmaps source directory. -# include it as #include -configure_file(testmaps.hh.in testmaps.hh @ONLY) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - add_subdirectory(3rdparty) add_subdirectory(common) add_subdirectory(bspinfo) @@ -114,14 +109,27 @@ endif () add_subdirectory(qbsp) add_subdirectory(vis) -add_subdirectory(docs) -add_subdirectory(tests) + +option(DISABLE_TESTS "Disables Tests" OFF) +option(DISABLE_DOCS "Disables Docs" OFF) + +if(NOT DISABLE_TESTS) + # just creates testmaps.hh with absolute path to the testmaps source directory. + # include it as #include + configure_file(testmaps.hh.in testmaps.hh @ONLY) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + add_subdirectory(tests) + + #CTest + enable_testing() +endif () + +if(NOT DISABLE_DOCS) + add_subdirectory(docs) +endif () install(FILES README.md DESTINATION bin) -#CTest -enable_testing() - #CPack configuration set(CPACK_GENERATOR ZIP)