Skip to content

Commit

Permalink
Add an option which disables unit tests and gtest (#238)
Browse files Browse the repository at this point in the history
Defaults to off, but allows the user to disable unit test
targets. This is particularly useful for target which are not
supported by gtest.
  • Loading branch information
paulhuggett authored Oct 15, 2024
1 parent 1709cae commit 71633bf
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ project (icubaby
DESCRIPTION "Little Library to Immediately Convert Unicode"
LANGUAGES C CXX
)
option (ICUBABY_COVERAGE "Generate LLVM Source-based Coverage")
option (ICUBABY_CXX17 "Use C++17 (rather than the default C++20)")
option (ICUBABY_EXAMPLES "Include example code in the generated build")
option (ICUBABY_FUZZTEST "Enable FuzzTest")
option (ICUBABY_COVERAGE "Generate LLVM Source-based Coverage" No)
option (ICUBABY_CXX17 "Use C++17 (rather than the default C++20)" No)
option (ICUBABY_EXAMPLES "Include example code in the generated build" No)
option (ICUBABY_FUZZTEST "Enable FuzzTest (if yes, overrides ICUBABY_UNIT_TESTS)" No)
option (ICUBABY_LIBCXX "Use libc++ rather than libstdc++ (clang only)")
option (ICUBABY_SANITIZE "Enable undefined behavior- and address-sanitizers where supported")
option (ICUBABY_STANDALONE "A standalone build includes test executables")
option (ICUBABY_WERROR "Compiler warnings are errors")
option (ICUBABY_SANITIZE "Enable undefined behavior- and address-sanitizers where supported" No)
option (ICUBABY_STANDALONE "A standalone build includes test executables" No)
option (ICUBABY_UNIT_TESTS "Include unit tests (and the Google Test framework) in the generated build?" Yes)
option (ICUBABY_WERROR "Compiler warnings are errors" No)

set (icubaby_project_root "${CMAKE_CURRENT_SOURCE_DIR}")
list (APPEND CMAKE_MODULE_PATH "${icubaby_project_root}/cmake")
Expand All @@ -56,7 +57,9 @@ if (ICUBABY_FUZZTEST)
include (GoogleTest)
fuzztest_setup_fuzzing_flags ()
else ()
setup_gtest ()
if (ICUBABY_UNIT_TESTS)
setup_gtest ()
endif (ICUBABY_UNIT_TESTS)
endif (ICUBABY_FUZZTEST)
enable_testing ()

Expand Down Expand Up @@ -104,7 +107,7 @@ if (ICUBABY_STANDALONE)
add_subdirectory (tests)
endif (ICUBABY_STANDALONE)

if (TARGET gtest)
if (ICUBABY_UNIT_TESTS AND TARGET gtest)
add_subdirectory (unittests)
endif ()

Expand Down

0 comments on commit 71633bf

Please sign in to comment.