mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
MSVC: use MSVC instead of GCC-like compiler flags.
- We can build with /W4, but it gives thousands of warnings. - _CRT_NONSTDC_NO_DEPRECATE disables warnings about POSIX functions. https://msdn.microsoft.com/en-us/library/ms235384.aspx - _CRT_SECURE_NO_WARNINGS https://msdn.microsoft.com/en-us/library/8ef0s5kh.aspx
This commit is contained in:
parent
b9d17c6a8a
commit
f15b864239
@ -68,7 +68,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
|
||||
# Enable -Wconversion.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
|
||||
endif()
|
||||
|
||||
# gcc 4.0 and better turn on _FORTIFY_SOURCE=2 automatically. This currently
|
||||
# does not work with Neovim due to some uses of dynamically-sized structures.
|
||||
@ -110,8 +112,14 @@ if(NOT HAS_ACCEPTABLE_FORTIFY)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1")
|
||||
endif()
|
||||
|
||||
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
|
||||
if(MSVC)
|
||||
# XXX: /W4 gives too many warnings. #3241
|
||||
add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
else()
|
||||
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
|
||||
-Wstrict-prototypes -std=gnu99)
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
# Use POSIX compatible stdio in Mingw
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO)
|
||||
|
@ -101,8 +101,10 @@ foreach(sfile ${CONV_SOURCES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(
|
||||
${CONV_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
|
||||
if(NOT MSVC)
|
||||
set_source_files_properties(
|
||||
${CONV_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
|
||||
endif()
|
||||
|
||||
get_directory_property(gen_cdefs COMPILE_DEFINITIONS)
|
||||
foreach(gen_cdef ${gen_cdefs} DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
|
||||
|
Loading…
Reference in New Issue
Block a user