Skip to content

Commit 47b9a6b

Browse files
Rafael Andrioli Bauerkris-jusiak
authored andcommitted
Add MSVC support
1 parent f80967c commit 47b9a6b

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

CMakeLists.txt

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# (See accompanying file LICENSE_1_0.txt or copy at
66
# http://www.boost.org/LICENSE_1_0.txt)
77
#
8-
cmake_minimum_required(VERSION 2.8)
8+
cmake_minimum_required(VERSION 2.8.12)
99
project(GUnit CXX)
1010

1111
set(MASTER_PROJECT OFF)
@@ -24,11 +24,24 @@ add_custom_command(TARGET style COMMAND find ${CMAKE_CURRENT_LIST_DIR}/benchmark
2424

2525
set(CMAKE_CXX_STANDARD 14)
2626

27-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
28-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
29-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
30-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
31-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
27+
if(NOT MSVC)
28+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
29+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
30+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
31+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
32+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
33+
endif()
34+
35+
if(MSVC)
36+
add_compile_options(/EHsc)
37+
# Statically link libraries
38+
# See https://gitlab.kitware.com/cmake/cmake/-/issues/18390
39+
add_compile_options(
40+
$<$<CONFIG:>:/MT>
41+
$<$<CONFIG:Debug>:/MTd>
42+
$<$<CONFIG:Release>:/MT>
43+
)
44+
endif(MSVC)
3245

3346
if(ENABLE_COVERAGE)
3447
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")

include/GUnit/Detail/ProgUtils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
//
88
#pragma once
99

10+
#if !defined(_WIN32) && !defined(_WIN64)
1011
#include <cxxabi.h>
12+
#endif
1113

1214
#include <memory>
1315
#include <string>
@@ -35,11 +37,15 @@ inline namespace v1 {
3537
namespace detail {
3638

3739
inline std::string demangle(const std::string &mangled) {
40+
#if !defined(_WIN32) && !defined(_WIN64)
3841
const auto demangled = abi::__cxa_demangle(mangled.c_str(), 0, 0, 0);
3942
if (demangled) {
4043
std::shared_ptr<char> free{demangled, std::free};
4144
return demangled;
4245
}
46+
#else
47+
return mangled;
48+
#endif
4349
return {};
4450
}
4551

include/GUnit/GSteps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ inline std::pair<bool, std::string> make_tags(const nlohmann::json& tags) {
175175
for (const auto& tag : tags) {
176176
std::string tag_name = tag["name"];
177177
if (i++) {
178-
result += ",";
178+
result += ";";
179179
}
180180
if (tag_name == "@disabled") {
181181
disabled = true;

libs/gherkin-cpp

0 commit comments

Comments
 (0)