Skip to content

Commit b47a376

Browse files
committed
Made library buildable for windows.
Modifications: - made symnlinks hardlinks cause git-for-windows/git#117 - made smallest random generated type in tests short because msvc's random lib doesnt support chars - updated some cmake stuff - Used the aaa rule to not assume the iterator type in commandhandler
1 parent 9bfde09 commit b47a376

File tree

7 files changed

+4916
-15
lines changed

7 files changed

+4916
-15
lines changed

CMakeLists.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ project(CommandLib)
33

44
set(CMAKE_CXX_STANDARD 11)
55

6-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror")
6+
if(MSVC)
7+
add_compile_options(/W4)
8+
else()
9+
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
10+
endif()
711

812
option(COVERAGE "build with coverage enabled" NO)
913
if(COVERAGE)
10-
set(CMAKE_BUILD_TYPE Debug)
11-
set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
12-
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
14+
if(MSVC)
15+
message(SEND_ERROR "MSVC doesnt support coverage flags")
16+
else()
17+
set(CMAKE_BUILD_TYPE Debug)
18+
add_compile_options("-g -O0 -fprofile-arcs -ftest-coverage")
19+
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
20+
endif()
1321
endif()
1422

1523

@@ -22,10 +30,10 @@ add_library(Commando
2230
include/Commando/Utils/ToNumber.hpp
2331
src/CommandHandler.cpp)
2432

25-
target_include_directories(Commando PUBLIC include)
26-
target_include_directories(Commando PUBLIC external/span-lite/include)
27-
target_include_directories(Commando PUBLIC external/string-view-lite/include)
28-
target_include_directories(Commando PUBLIC external/optional-lite/include)
33+
target_include_directories(Commando PUBLIC "include")
34+
target_include_directories(Commando PUBLIC "external/span-lite/include")
35+
target_include_directories(Commando PUBLIC "external/string-view-lite/include")
36+
target_include_directories(Commando PUBLIC "external/optional-lite/include")
2937

3038
include(tests/CMakeLists.txt)
3139

include/Commando/CommandHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CommandHandler : public CommandHandlerBase {
4747
return CommandStatus::NoCommand;
4848
}
4949

50-
Command *const *command = find_command(args[0]);
50+
const auto command = find_command(args[0]);
5151
if(command == commands.end()) {
5252
return CommandStatus::CommandNotFound;
5353
}

0 commit comments

Comments
 (0)