From 2cdb8e215d930b8a557760dc2a5ed4dc61e01128 Mon Sep 17 00:00:00 2001 From: doobie Date: Tue, 20 Sep 2022 12:43:00 -0400 Subject: [PATCH] [Added cmakelist flag] Added flag to allow users to specify if the gtest binaries should be built --- .gitignore | 3 ++- CMakeLists.txt | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 54ca854..99d14cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ cmake-build* -.idea \ No newline at end of file +.idea +.DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ac6e6c..de0b964 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,14 @@ include(build_utils) add_library(thread_pool SHARED thread_pool.c) set_project_properties(thread_pool ${PROJECT_SOURCE_DIR}) -# If debug is enabled make sure to include CTest at the root. This will allow -# the ctest config to be placed at the root of the build directory -IF (CMAKE_BUILD_TYPE STREQUAL "Debug") - include(CTest) - add_subdirectory(tests) +# Flag is used to build the gtest binaries +option(BUILD_THPOOL_GTEST "Build GTests for thread_pool_c" ON) + +if (BUILD_THPOOL_GTEST) + # If debug is enabled make sure to include CTest at the root. This will allow + # the ctest config to be placed at the root of the build directory + IF (CMAKE_BUILD_TYPE STREQUAL "Debug") + include(CTest) + ENDIF() ENDIF() +