summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-12-31 02:04:12 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-12-31 02:04:12 +0300
commit38d7a92b8b90ac0d5c3d178ea15c376a9490524e (patch)
tree0b7833e10cb7663946db84e1a1aec602cc7a3b1b /CMakeLists.txt
parente611cf663d767cae36d4493b53d1eeccfe112506 (diff)
downloadbdwgc-38d7a92b8b90ac0d5c3d178ea15c376a9490524e.tar.gz
Workaround gctest hang if test compiled as C++ code by MSVC (CMake)
* CMakeLists.txt [build_tests && enable_cplusplus && MSVC] (tests/test.c): Do not set source files LANGUAGE property to CXX; add comment.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 5 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21132ef0..d84935fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -655,8 +655,11 @@ if (build_tests)
# Compile some tests as C++ to test extern "C" in header files.
if (enable_cplusplus)
- set_source_files_properties(tests/leak_test.c tests/test.c
- PROPERTIES LANGUAGE CXX)
+ set_source_files_properties(tests/leak_test.c PROPERTIES LANGUAGE CXX)
+ if (NOT MSVC)
+ # WinMain-based test hangs at startup if compiled by VC as C++ code.
+ set_source_files_properties(tests/test.c PROPERTIES LANGUAGE CXX)
+ endif()
# To avoid "treating 'c' input as 'c++' when in C++ mode" Clang warning.
if (NOT (BORLAND OR MSVC OR WATCOM))
add_compile_options(-x c++)