Skip to content

Commit a2e01cc

Browse files
committed
Add an option ENABLE_UNITTEST_CPP_TESTS to disable the built-in (not file-based) C++ catch tests
1 parent d4d7cba commit a2e01cc

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,9 @@ option(DEBUG_STACKTRACE "Debug setting: print a stracktrace on asserts and when
428428
option(DEBUG_MOVE "Debug setting: Ensure std::move is being used" FALSE)
429429
option(VERIFY_VECTOR "Debug setting: verify vectors (options: dictionary_expression, dictionary_operator, constant_operator, sequence_operator, nested_shuffle)" "none")
430430
option(CLANG_TIDY "Enable build for clang-tidy, this disables all source files excluding the core database. This does not produce a working build." FALSE)
431-
option(BUILD_UNITTESTS "Build the C++ Unit Tests." TRUE)
432-
option(UNITTEST_ROOT_DIRECTORY "The unittest root directory (defaults to the project source directory)" "${PROJECT_SOURCE_DIR}")
431+
option(BUILD_UNITTESTS "Build the unittest runner." TRUE)
432+
option(UNITTEST_ROOT_DIRECTORY "The unittest root directory (defaults to the project source directory)" FALSE)
433+
option(ENABLE_UNITTEST_CPP_TESTS "Build the C++ Unit Tests." TRUE)
433434
option(EXTENSION_CONFIG_BUILD "Produce extension configuration artifacts instead of building. (such as shared vcpkg.json, extensions.txt)" FALSE)
434435
option(CUSTOM_LINKER "Use a custom linker program" "")
435436
option(CRASH_ON_ASSERT "Trigger a sigabort on an assert failing, instead of throwing an exception" FALSE)

test/CMakeLists.txt

+20-14
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,24 @@ include_directories(include)
77
include_directories("${PROJECT_BINARY_DIR}/codegen/include/")
88
add_definitions(-DGENERATED_EXTENSION_HEADERS=1)
99

10-
add_subdirectory(api)
11-
add_subdirectory(appender)
12-
add_subdirectory(arrow)
13-
add_subdirectory(catalog)
14-
add_subdirectory(common)
10+
if(${ENABLE_UNITTEST_CPP_TESTS})
11+
add_subdirectory(api)
12+
add_subdirectory(appender)
13+
add_subdirectory(arrow)
14+
add_subdirectory(catalog)
15+
add_subdirectory(common)
16+
add_subdirectory(logging)
17+
add_subdirectory(memoryleak)
18+
add_subdirectory(parallel_csv)
19+
add_subdirectory(secrets)
20+
add_subdirectory(serialize)
21+
add_subdirectory(sql)
22+
add_subdirectory(ossfuzz)
23+
add_subdirectory(mbedtls)
24+
endif()
1525
add_subdirectory(extension)
1626
add_subdirectory(helpers)
17-
add_subdirectory(logging)
18-
add_subdirectory(memoryleak)
19-
add_subdirectory(parallel_csv)
20-
add_subdirectory(secrets)
21-
add_subdirectory(serialize)
22-
add_subdirectory(sql)
2327
add_subdirectory(sqlite)
24-
add_subdirectory(ossfuzz)
25-
add_subdirectory(mbedtls)
2628

2729
if(NOT WIN32 AND NOT SUN)
2830
if(${BUILD_TPCE})
@@ -31,7 +33,11 @@ if(NOT WIN32 AND NOT SUN)
3133
add_subdirectory(persistence)
3234
endif()
3335

34-
add_definitions(-DDUCKDB_ROOT_DIRECTORY="${UNITTEST_ROOT_DIRECTORY}")
36+
if(${UNITTEST_ROOT_DIRECTORY})
37+
add_definitions(-DDUCKDB_ROOT_DIRECTORY="${UNITTEST_ROOT_DIRECTORY}")
38+
else()
39+
add_definitions(-DDUCKDB_ROOT_DIRECTORY="${PROJECT_SOURCE_DIR}")
40+
endif()
3541

3642
add_executable(unittest unittest.cpp ${ALL_OBJECT_FILES})
3743

0 commit comments

Comments
 (0)