mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
build: set MIN_LOG_LEVEL correctly (#7419)
closes #7283 regression by42d892913d
- Don't need to explicitly put "-O2 -g" in RelWithDebInfo; CMake does that already. That was left-over from42d892913d
which removed the "Dev" custom build-type, but repurposed the logic for RelWithDebInfo. - `if(DEFINED MIN_LOG_LEVEL)` doesn't work. - `if(${MIN_LOG_LEVEL} MATCHES "^$")` doesn't work if -DMIN_LOG_LEVEL is omitted. - `if(MIN_LOG_LEVEL)` also isn't what we want: it would be true if MIN_LOG_LEVEL=0.
This commit is contained in:
parent
6338199b76
commit
37420ef942
@ -113,15 +113,14 @@ else()
|
|||||||
set(HAS_OG_FLAG 0)
|
set(HAS_OG_FLAG 0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set custom build flags for RelWithDebInfo.
|
#
|
||||||
# -DNDEBUG purposely omitted because we want assertions.
|
# Build-type: RelWithDebInfo
|
||||||
|
#
|
||||||
if(HAS_OG_FLAG)
|
if(HAS_OG_FLAG)
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Og -g"
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -Og -g")
|
||||||
CACHE STRING "Flags used by the compiler during release-with-debug builds." FORCE)
|
endif()
|
||||||
elseif(NOT MSVC)
|
# We _want_ assertions in RelWithDebInfo build-type.
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g"
|
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
|
||||||
CACHE STRING "Flags used by the compiler during release-with-debug builds." FORCE)
|
|
||||||
elseif(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()
|
||||||
|
|
||||||
@ -479,20 +478,19 @@ install_helper(
|
|||||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||||
|
|
||||||
# MIN_LOG_LEVEL for log.h
|
# MIN_LOG_LEVEL for log.h
|
||||||
if(DEFINED MIN_LOG_LEVEL)
|
if("${MIN_LOG_LEVEL}" MATCHES "^$")
|
||||||
|
message(STATUS "MIN_LOG_LEVEL not specified")
|
||||||
|
else()
|
||||||
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
|
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
|
||||||
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
|
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "MIN_LOG_LEVEL set to ${MIN_LOG_LEVEL}")
|
message(STATUS "MIN_LOG_LEVEL set to ${MIN_LOG_LEVEL}")
|
||||||
else()
|
|
||||||
message(STATUS "MIN_LOG_LEVEL not specified, defaulting to 1 (INFO)")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Go down the tree.
|
# Go down the tree.
|
||||||
|
|
||||||
add_subdirectory(src/nvim)
|
add_subdirectory(src/nvim)
|
||||||
# Read compilation flags from src/nvim,
|
# Read compilation flags from src/nvim, used in config subdirectory below.
|
||||||
# used in config subdirectory below.
|
|
||||||
include(GetCompileFlags)
|
include(GetCompileFlags)
|
||||||
get_compile_flags(NVIM_VERSION_CFLAGS)
|
get_compile_flags(NVIM_VERSION_CFLAGS)
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ if(NOT MSVC)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED MIN_LOG_LEVEL)
|
if(NOT "${MIN_LOG_LEVEL}" MATCHES "^$")
|
||||||
add_definitions(-DMIN_LOG_LEVEL=${MIN_LOG_LEVEL})
|
add_definitions(-DMIN_LOG_LEVEL=${MIN_LOG_LEVEL})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user