Skip to content

Commit 057dade

Browse files
Fix support for CMake unity builds
1 parent a2baab7 commit 057dade

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ if(PROJECT_IS_TOP_LEVEL)
6767
)
6868
endif()
6969

70-
# When compiling C++ with GCC, set a deeper diagnostics depth
71-
add_compile_options($<$<AND:$<CXX_COMPILER_ID:GNU>,$<COMPILE_LANGUAGE:CXX>>:-fconcepts-diagnostics-depth=4>)
70+
add_compile_options(
71+
# When compiling C++ with GCC, set a deeper diagnostics depth
72+
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<COMPILE_LANGUAGE:CXX>>:-fconcepts-diagnostics-depth=4>
73+
# Enable large object files with MSVC
74+
$<$<CXX_COMPILER_ID:MSVC>:/bigobj>
75+
)
7276

7377
# If we generate any DLLs, use a .dll.lib suffix for the importlibs, to distinguish
7478
# them from actual static libraries

tools/GenURITests.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ set(GenURITests_HEAD [[// clang-format off
3131

3232
using namespace amongoc;
3333

34+
// Guard this section to support unity builds involving these files
35+
#ifndef URI_TESTS_COMMON_BLOCK
36+
#define URI_TESTS_COMMON_BLOCK
37+
3438
inline std::variant<string, int> w_parameter(int n) {
3539
return n;
3640
}
@@ -73,6 +77,9 @@ consteval server_monitoring_mode smm(std::string_view sv) {
7377
throw;
7478
}
7579
}
80+
81+
#endif // URI_TESTS_COMMON_BLOCK
82+
7683
]])
7784

7885
set(__param_canon_spelling [[{

0 commit comments

Comments
 (0)