Skip to content

Commit f07975a

Browse files
committed
fix: do not use wmain with catch2 by defining DO_NOT_USE_WMAIN
catchorg/Catch2#2441
1 parent 2179862 commit f07975a

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,4 @@ words:
7979
- VSINSTALLDIR
8080
- vswhere
8181
- webp
82+
- WMAIN

my_exe/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ target_link_libraries(
2828
${my_exe_LINKED_LIBRARIES})
2929

3030
# generate a main function for the test executable
31-
target_compile_definitions(my_exe_helpers_tests PRIVATE CATCH_CONFIG_MAIN)
31+
target_compile_definitions(my_exe_helpers_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
3232

3333
# use xml reporter if coverage is enabled
3434
if(${ENABLE_COVERAGE})

my_header_lib/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ target_link_libraries(
1919
project_options
2020
Catch2::Catch2)
2121
# generate a main function for the test executable
22-
target_compile_definitions(my_header_lib_tests PRIVATE CATCH_CONFIG_MAIN)
22+
target_compile_definitions(my_header_lib_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
2323

2424
# use xml reporter if coverage is enabled
2525
if(${ENABLE_COVERAGE})

my_header_lib/test/constexpr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ target_link_libraries(
77
project_warnings
88
project_options
99
Catch2::Catch2)
10-
target_compile_definitions(my_header_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
10+
target_compile_definitions(my_header_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
1111

1212
catch_discover_tests(my_header_lib_constexpr_tests ${COVERAGE_ARGS})
1313

@@ -21,7 +21,7 @@ target_link_libraries(
2121
project_warnings
2222
project_options
2323
Catch2::Catch2)
24-
target_compile_definitions(my_header_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
24+
target_compile_definitions(my_header_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
2525
target_compile_definitions(my_header_lib_relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
2626

2727
catch_discover_tests(my_header_lib_relaxed_constexpr_tests ${COVERAGE_ARGS})

my_lib/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ target_link_libraries(
1919
project_options
2020
Catch2::Catch2)
2121
# generate a main function for the test executable
22-
target_compile_definitions(my_lib_tests PRIVATE CATCH_CONFIG_MAIN)
22+
target_compile_definitions(my_lib_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
2323

2424
# use xml reporter if coverage is enabled
2525
if(${ENABLE_COVERAGE})

my_lib/test/constexpr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ target_link_libraries(
77
project_warnings
88
project_options
99
Catch2::Catch2)
10-
target_compile_definitions(my_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
10+
target_compile_definitions(my_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
1111

1212
catch_discover_tests(my_lib_constexpr_tests ${COVERAGE_ARGS})
1313

@@ -21,7 +21,7 @@ target_link_libraries(
2121
project_warnings
2222
project_options
2323
Catch2::Catch2)
24-
target_compile_definitions(my_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
24+
target_compile_definitions(my_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
2525
target_compile_definitions(my_lib_relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
2626

2727
catch_discover_tests(my_lib_relaxed_constexpr_tests ${COVERAGE_ARGS})

0 commit comments

Comments
 (0)