From 7a034caa6c5759e6b3e7b394d6cd3511573120ed Mon Sep 17 00:00:00 2001 From: klaus triendl Date: Sat, 18 May 2024 19:07:27 +0300 Subject: [PATCH] Explicitly set the entry point of the unit test executable ... otherwise for some reason the msvc linker will not pick up `wmain`, which is provided by the static Catch2 library. This is important for Windows Unicode builds, e.g. those performed by build environments for the Windows Store such as vcpkg's "x64-uwp" triplet. --- tests/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b13578d9..f63509ff 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -182,6 +182,11 @@ if (MSVC) # C4458: declaration of 'symbol' hides class member /wd4458) endif() + if (CMAKE_CXX_FLAGS MATCHES "/D_UNICODE") + # explicitly set the entry point of the executable file, + # otherwise for some reason the linker will not pick up `wmain`, which is provided by the static Catch2 library + target_link_options(unit_tests PRIVATE "/ENTRY:wmainCRTStartup") + endif() endif() target_precompile_headers(unit_tests PRIVATE