Skip to content

Commit 1018a48

Browse files
committed
Insert os specific warnings
1 parent 7142ed6 commit 1018a48

File tree

6 files changed

+45
-9
lines changed

6 files changed

+45
-9
lines changed

cmake/clang_warnings.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030

3131
set(WARNING_FLAGS
3232

33-
# From Xcode default project
34-
# -Wno-sign-conversion
35-
# -Wno-exit-time-destructors
36-
# -Wno-conversion
37-
3833
# Own parameter
3934
-Wno-c++98-compat # C++11
4035
-Wno-c++98-compat-pedantic # C++11

cmake/env.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
7070
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_SPACED}")
7171

7272
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
73+
include(${CMAKE}/msvc_warnings.cmake)
74+
75+
set(WARNING_FLAGS_SPACED "")
76+
foreach(WARNING_FLAG ${WARNING_FLAGS})
77+
set(WARNING_FLAGS_SPACED "${WARNING_FLAGS_SPACED} ${WARNING_FLAG}")
78+
endforeach()
79+
7380
# Force to always compile with W4
7481
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
7582
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")

cmake/gcc_warnings.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@
2929
#
3030

3131
set(WARNING_FLAGS
32-
33-
# -Wno-unknown-pragmas
3432
)

cmake/msvc_warnings.cmake

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright (c) 2020 Florian Becker <[email protected]> (VX APPS).
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
#
8+
# 1. Redistributions of source code must retain the above copyright notice, this
9+
# list of conditions and the following disclaimer.
10+
#
11+
# 2. Redistributions in binary form must reproduce the above copyright notice,
12+
# this list of conditions and the following disclaimer in the documentation
13+
# and/or other materials provided with the distribution.
14+
#
15+
# 3. Neither the name of the copyright holder nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
#
30+
31+
set(WARNING_FLAGS
32+
)

source/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030

3131
project(modern.cpp.core)
3232

33+
if(UNIX)
34+
set(${PROJECT_NAME}_os_src unixservice/main.cpp)
35+
endif()
36+
3337
add_library(${PROJECT_NAME}
3438
../README.md
3539
CPU.cpp
@@ -48,7 +52,7 @@ add_library(${PROJECT_NAME}
4852
Timing.h
4953
templates/CSVWriter.h
5054
templates/Timer.h
51-
unixservice/main.cpp
55+
${${PROJECT_NAME}_os_src}
5256
)
5357

5458
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/templates)

source/KeyState.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#ifdef _WIN32
3232
#include <Windows.h>
33-
#elif defined(__APPLE__)
33+
#elif __APPLE__
3434
#include <Carbon/Carbon.h>
3535
#endif
3636

0 commit comments

Comments
 (0)