mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
build: set compiler options in one place
- add_definitions() is preferred to CMAKE_C_FLAGS.
This commit is contained in:
parent
da88278f27
commit
4386814b04
@ -172,11 +172,6 @@ if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
|
|||||||
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Enable -Wconversion.
|
|
||||||
if(NOT MSVC)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow -Wconversion")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently
|
# gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently
|
||||||
# does not work with Neovim due to some uses of dynamically-sized structures.
|
# does not work with Neovim due to some uses of dynamically-sized structures.
|
||||||
# https://github.com/neovim/neovim/issues/223
|
# https://github.com/neovim/neovim/issues/223
|
||||||
@ -264,7 +259,7 @@ if(MSVC)
|
|||||||
add_definitions(-DWIN32)
|
add_definitions(-DWIN32)
|
||||||
else()
|
else()
|
||||||
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
|
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
|
||||||
-Wstrict-prototypes -std=gnu99)
|
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion)
|
||||||
|
|
||||||
check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||||
if(HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
if(HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||||
|
Loading…
Reference in New Issue
Block a user