| 1 |
# MSVC compiler specific settings |
| 2 |
|
| 3 |
if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC") |
| 4 |
return() |
| 5 |
endif() |
| 6 |
|
| 7 |
include(utils/arch) |
| 8 |
|
| 9 |
if(ARCH MATCHES "x86" OR ARCH MATCHES "x86_64") |
| 10 |
enable_language(ASM_MASM) |
| 11 |
|
| 12 |
set(ASM_SOURCES |
| 13 |
${SOURCE_DIR}/asm/snapvector.asm |
| 14 |
${SOURCE_DIR}/asm/ftola.asm |
| 15 |
) |
| 16 |
endif() |
| 17 |
|
| 18 |
if(ARCH MATCHES "x86_64") |
| 19 |
list(APPEND ASM_SOURCES ${SOURCE_DIR}/asm/vm_x86_64.asm) |
| 20 |
set_source_files_properties( |
| 21 |
${ASM_SOURCES} |
| 22 |
PROPERTIES COMPILE_DEFINITIONS "idx64") |
| 23 |
endif() |
| 24 |
|
| 25 |
# Baseline warnings |
| 26 |
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/W4>") |
| 27 |
|
| 28 |
# C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data |
| 29 |
# There are way too many of these to realistically deal with them |
| 30 |
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4267>") |
| 31 |
|
| 32 |
# C4206: nonstandard extension used: translation unit is empty |
| 33 |
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4206>") |
| 34 |
|
| 35 |
# C4324: 'struct': structure was padded due to alignment specifier |
| 36 |
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4324>") |
| 37 |
|
| 38 |
# C4200: nonstandard extension used: zero-sized array in struct/union |
| 39 |
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4200>") |
| 40 |
|
| 41 |
# MSVC doesn't understand __inline__, which libjpeg uses |
| 42 |
add_compile_definitions(__inline__=inline) |
| 43 |
|
| 44 |
# It's unlikely that we'll move to the _s variants, so stop the warning |
| 45 |
add_compile_definitions(_CRT_SECURE_NO_WARNINGS) |
| 46 |
|
| 47 |
# The sockets platform abstraction layer necessarily uses deprecated APIs |
| 48 |
add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS) |