Skip to content

Commit

Permalink
fix: do not use wmain with catch2 by defining DO_NOT_USE_WMAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jun 2, 2022
1 parent 2179862 commit f07975a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ words:
- VSINSTALLDIR
- vswhere
- webp
- WMAIN
2 changes: 1 addition & 1 deletion my_exe/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ target_link_libraries(
${my_exe_LINKED_LIBRARIES})

# generate a main function for the test executable
target_compile_definitions(my_exe_helpers_tests PRIVATE CATCH_CONFIG_MAIN)
target_compile_definitions(my_exe_helpers_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)

# use xml reporter if coverage is enabled
if(${ENABLE_COVERAGE})
Expand Down
2 changes: 1 addition & 1 deletion my_header_lib/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target_link_libraries(
project_options
Catch2::Catch2)
# generate a main function for the test executable
target_compile_definitions(my_header_lib_tests PRIVATE CATCH_CONFIG_MAIN)
target_compile_definitions(my_header_lib_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)

# use xml reporter if coverage is enabled
if(${ENABLE_COVERAGE})
Expand Down
4 changes: 2 additions & 2 deletions my_header_lib/test/constexpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target_link_libraries(
project_warnings
project_options
Catch2::Catch2)
target_compile_definitions(my_header_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
target_compile_definitions(my_header_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)

catch_discover_tests(my_header_lib_constexpr_tests ${COVERAGE_ARGS})

Expand All @@ -21,7 +21,7 @@ target_link_libraries(
project_warnings
project_options
Catch2::Catch2)
target_compile_definitions(my_header_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
target_compile_definitions(my_header_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
target_compile_definitions(my_header_lib_relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE)

catch_discover_tests(my_header_lib_relaxed_constexpr_tests ${COVERAGE_ARGS})
2 changes: 1 addition & 1 deletion my_lib/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target_link_libraries(
project_options
Catch2::Catch2)
# generate a main function for the test executable
target_compile_definitions(my_lib_tests PRIVATE CATCH_CONFIG_MAIN)
target_compile_definitions(my_lib_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)

# use xml reporter if coverage is enabled
if(${ENABLE_COVERAGE})
Expand Down
4 changes: 2 additions & 2 deletions my_lib/test/constexpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target_link_libraries(
project_warnings
project_options
Catch2::Catch2)
target_compile_definitions(my_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
target_compile_definitions(my_lib_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)

catch_discover_tests(my_lib_constexpr_tests ${COVERAGE_ARGS})

Expand All @@ -21,7 +21,7 @@ target_link_libraries(
project_warnings
project_options
Catch2::Catch2)
target_compile_definitions(my_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN)
target_compile_definitions(my_lib_relaxed_constexpr_tests PRIVATE CATCH_CONFIG_MAIN DO_NOT_USE_WMAIN)
target_compile_definitions(my_lib_relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE)

catch_discover_tests(my_lib_relaxed_constexpr_tests ${COVERAGE_ARGS})

0 comments on commit f07975a

Please sign in to comment.