diff --git a/CMakeLists.txt b/CMakeLists.txt index 78037a0..da866c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,26 +10,25 @@ set(SUPPORTED_CXX_STANDARDS 14 17) if(NOT DEFINED CMAKE_CXX_STANDARD) message(STATUS "Setting C++ version to '14' as none was specified.") set(CMAKE_CXX_STANDARD 14) - if (MSVC) - # Turn off Microsofts "security" warnings. + if (WIN32) + # Turn off Microsofts "security" warnings. add_compile_definitions(_CRT_SECURE_NO_WARNINGS NDEBUG _CONSOLE _SCL_SECURE_NO_WARNINGS NOGDICAPMASKS NOVIRTUALKEYCODES NOWINMESSAGES NOWINSTYLES NOSYSMETRICS NOMENUS NOICONS NOKEYSTATES NOSYSCOMMANDS NORASTEROPS NOSHOWWINDOW OEMRESOURCE NOATOM NOCLIPBOARD NOCOLOR NOCTLMGR NODRAWTEXT NOGDI NOKERNEL NOUSER NONLS NOMB NOMEMMGR NOMETAFILE NOMINMAX NOMSG NOOPENFILE NOSCROLL NOSOUND NOTEXTMETRIC NOWH NOWINOFFSETS NOCOMM NOKANJI NOHELP NOPROFILER NODEFERWINDOWPOS NOMCX) - add_compile_options(/EHa /MT$<$:d>) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") + add_compile_options("/EHa") else() - SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb") - add_compile_options("-Wall" "-Wpedantic" "-Wextra" "-fexceptions") + string(FIND "${CMAKE_CXX_FLAGS_DEBUG}" "-O0" nPos) + if(${nPos} EQUAL "-1") + SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb -D_DEBUG -DDEBUG") + add_compile_options("-Wall" "-Wpedantic" "-Wextra" "-fexceptions") + else() + message(STATUS "${PROJECT_NAME}: CMAKE_CXX_FLAGS_DEBUG hat bereits -O0 enthalten") + endif() endif() else() message(STATUS "${PROJECT_NAME}: CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} set by parent project.") endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) -string(FIND "${CMAKE_CXX_FLAGS_DEBUG}" "-O0" nPos) -if(${nPos} EQUAL "-1") - SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb -D_DEBUG -DDEBUG") -else() - message(STATUS "${PROJECT_NAME}: CMAKE_CXX_FLAGS_DEBUG hat bereits -O0 enthalten") -endif() - set(targetSrc ${CMAKE_CURRENT_LIST_DIR}/ServMain.cpp ) diff --git a/ServMain.cpp b/ServMain.cpp index d8b0e33..fe9c59f 100644 --- a/ServMain.cpp +++ b/ServMain.cpp @@ -99,7 +99,10 @@ class Service : public CBaseSrv { #if defined(_WIN32) || defined(_WIN64) if (iSignal == SIGINT) + { Service::GetInstance().CallSignalCallback(); + signal(SIGINT, Service::SignalHandler); + } #else if (iSignal == SIGQUIT) Service::GetInstance().Stop();