From 5a7c021dab6de484590a45701e8eab29b1a7b718 Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 14 Nov 2017 19:44:40 +0100 Subject: [PATCH] Added MSVC support to cmake files (not tested, but hopefully it works). Some tests are disabled due to lacking MSVC options. --- CMakeLists.txt | 6 +++++- tests/CMakeLists.txt | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0b1acf..6289957 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,11 @@ project (Simple-Web-Server) option(USE_STANDALONE_ASIO "set ON to use standalone Asio instead of Boost.Asio" OFF) option(BUILD_TESTING "set ON to build library tests" OFF) -add_compile_options(-std=c++11 -Wall -Wextra -Wsign-conversion) +if(NOT MSVC) + add_compile_options(-std=c++11 -Wall -Wextra -Wsign-conversion) +else() + add_compile_options(/W1) +endif() add_library(simple-web-server INTERFACE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a8a0d45..45fa95e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,12 +1,14 @@ -add_compile_options(-fno-access-control) +if(NOT MSVC) + add_compile_options(-fno-access-control) + + add_executable(io_test io_test.cpp) + target_link_libraries(io_test simple-web-server) + add_test(io_test io_test) -add_executable(io_test io_test.cpp) -target_link_libraries(io_test simple-web-server) -add_test(io_test io_test) - -add_executable(parse_test parse_test.cpp) -target_link_libraries(parse_test simple-web-server) -add_test(parse_test parse_test) + add_executable(parse_test parse_test.cpp) + target_link_libraries(parse_test simple-web-server) + add_test(parse_test parse_test) +endif() if(OPENSSL_FOUND) add_executable(crypto_test crypto_test.cpp)