Skip to content

Commit 7cdbe41

Browse files
authored
Merge pull request #249 from Atari2/reduce-warnings
Reduce warnings
2 parents d978e67 + 67cd87c commit 7cdbe41

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
cmake_policy(SET CMP0091 NEW)
12
project(Asar)
23

34
cmake_minimum_required(VERSION 3.9.0)

src/asar/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@ set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fsanitize=address")
1919
# stand-alone application and library interface
2020

2121
macro(set_asar_shared_properties target msvc_lib_type_param enable_sanitizer)
22+
# this is here because in CMake you can't modify macro parameters
23+
# so we create a new variable
24+
set(msvc_lib_type_var ${msvc_lib_type_param})
2225
if (MSVC)
2326
if (MSVC_LIB_TYPE)
24-
set(msvc_lib_type_param ${MSVC_LIB_TYPE})
27+
set(msvc_lib_type_var ${MSVC_LIB_TYPE})
2528
endif()
26-
if (NOT (${msvc_lib_type_param} STREQUAL "D" OR ${msvc_lib_type_param} STREQUAL "T"))
27-
message(FATAL_ERROR "Invalid MSVC_LIB_TYPE, valid types are T and D")
29+
if ("${msvc_lib_type_var}" STREQUAL "D")
30+
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
31+
elseif ("${msvc_lib_type_var}" STREQUAL "T")
32+
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
33+
else()
34+
message(FATAL_ERROR "Invalid MSVC_LIB_TYPE, valid types are T and D instead of ${msvc_lib_type_var}")
2835
endif()
2936
endif()
3037

@@ -74,7 +81,7 @@ macro(set_asar_shared_properties target msvc_lib_type_param enable_sanitizer)
7481
# Enable maximum warning level
7582

7683
if(MSVC)
77-
target_compile_options(${target} PRIVATE /Wall "/M${msvc_lib_type_param}$<$<CONFIG:Debug>:d>" /EHa)
84+
target_compile_options(${target} PRIVATE /W3 /EHa)
7885

7986
# These certainly aren't worth a warning, though
8087
target_compile_options(${target} PRIVATE
@@ -83,6 +90,8 @@ macro(set_asar_shared_properties target msvc_lib_type_param enable_sanitizer)
8390
/wd4711 # function selected for automatic inline expansion
8491
/wd4820 # 'bytes' bytes padding added after construct 'member_name'
8592
/wd4464 # relativ include path contains '..'
93+
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
94+
/wd5045 # compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
8695
)
8796
target_link_options(${target} PRIVATE /STACK:4194304)
8897
if(MSVC_VERSION VERSION_LESS "1900")

0 commit comments

Comments
 (0)