From 0987464cf99120b6728949496ee41bd14a35b225 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 24 Dec 2022 17:08:15 +0800 Subject: Make it compile with MSVC. --- CMakeLists.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 22b29e8..332f10e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,15 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(common_compiler_args "-Wall -Werror -Wno-unused -std=c++11") -set(CMAKE_CXX_FLAGS_DEBUG "${common_compiler_args} -g -ggdb -fsanitize=address -DDEBUG") +set(common_compiler_args "-Wall") +if (!MSVC) + set(common_compiler_args "${common_compiler_args} -Werror") +endif () +set(common_compiler_args, "${common_compiler_args} -Wno-unused -std=c++11") + +if (!MSVC) + set(CMAKE_CXX_FLAGS_DEBUG "${common_compiler_args} -g -ggdb -fsanitize=address -DDEBUG") +endif () set(CMAKE_CXX_FLAGS_RELEASE "${common_compiler_args} -O2") set(CMAKE_VERBOSE_MAKEFILE on) @@ -14,10 +21,12 @@ set(CMAKE_VERBOSE_MAKEFILE on) # Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") cmake_policy(SET CMP0135 NEW) -endif() +endif () -link_libraries(pthread) -link_libraries(atomic) +if (!MSVC) + link_libraries(pthread) + link_libraries(atomic) +endif () # main executable -- cgit v1.2.3