aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt48
1 files changed, 28 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ea3252755..26a6529fcd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -85,11 +85,19 @@ endif()
option(ENABLE_LIBINTL "enable libintl" ON)
option(ENABLE_LIBICONV "enable libiconv" ON)
+if (MINGW)
+ # Disable LTO by default as it may not compile
+ # See https://github.com/Alexpux/MINGW-packages/issues/3516
+ # and https://github.com/neovim/neovim/pull/8654#issuecomment-402316672
+ option(ENABLE_LTO "enable link time optimization" OFF)
+else()
+ option(ENABLE_LTO "enable link time optimization" ON)
+endif()
# Set default build type.
if(NOT CMAKE_BUILD_TYPE)
- message(STATUS "CMAKE_BUILD_TYPE not given, defaulting to 'Debug'.")
- set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
+ message(STATUS "CMAKE_BUILD_TYPE not given, defaulting to 'Debug'")
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
endif()
# Set available build types for CMake GUIs.
@@ -101,13 +109,13 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
# version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 3)
-set(NVIM_VERSION_PATCH 1)
-set(NVIM_VERSION_PRERELEASE "") # for package maintainers
+set(NVIM_VERSION_PATCH 2)
+set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
# API level
-set(NVIM_API_LEVEL 4) # Bump this after any API change.
+set(NVIM_API_LEVEL 5) # Bump this after any API change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
-set(NVIM_API_PRERELEASE false)
+set(NVIM_API_PRERELEASE true)
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
include(GetGitRevisionDescription)
@@ -129,7 +137,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Default to -O2 on release builds.
if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
- message(STATUS "Replacing -O3 in CMAKE_C_FLAGS_RELEASE with -O2.")
+ message(STATUS "Replacing -O3 in CMAKE_C_FLAGS_RELEASE with -O2")
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
@@ -197,12 +205,12 @@ main(void)
" HAS_ACCEPTABLE_FORTIFY)
if(NOT HAS_ACCEPTABLE_FORTIFY)
- message(STATUS "Unsupported _FORTIFY_SOURCE found, forcing _FORTIFY_SOURCE=1.")
+ message(STATUS "Unsupported _FORTIFY_SOURCE found, forcing _FORTIFY_SOURCE=1")
# Extract possible prefix to _FORTIFY_SOURCE (e.g. -Wp,-D_FORTIFY_SOURCE).
STRING(REGEX MATCH "[^\ ]+-D_FORTIFY_SOURCE" _FORTIFY_SOURCE_PREFIX "${CMAKE_C_FLAGS}")
STRING(REPLACE "-D_FORTIFY_SOURCE" "" _FORTIFY_SOURCE_PREFIX "${_FORTIFY_SOURCE_PREFIX}" )
if(NOT _FORTIFY_SOURCE_PREFIX STREQUAL "")
- message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}.")
+ message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}")
endif()
# -U in add_definitions doesn't end up in the correct spot, so we add it to
# the flags variable instead.
@@ -214,7 +222,7 @@ endif()
if(CMAKE_EXE_LINKER_FLAGS MATCHES "--sort-common" OR
CMAKE_SHARED_LINKER_FLAGS MATCHES "--sort-common" OR
CMAKE_MODULE_LINKER_FLAGS MATCHES "--sort-common")
- message(STATUS "Removing --sort-common from linker flags.")
+ message(STATUS "Removing --sort-common from linker flags")
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
@@ -301,10 +309,10 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
endif()
endif()
-option(TRAVIS_CI_BUILD "Travis/QuickBuild CI. Extra flags will be set." OFF)
+option(TRAVIS_CI_BUILD "Travis/QuickBuild CI, extra flags will be set" OFF)
if(TRAVIS_CI_BUILD)
- message(STATUS "Travis/QuickBuild CI build enabled.")
+ message(STATUS "Travis/QuickBuild CI build enabled")
add_definitions(-Werror)
if(DEFINED ENV{BUILD_32BIT})
# Get some test coverage for unsigned char
@@ -360,7 +368,7 @@ include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
if(PREFER_LUA)
- find_package(Lua REQUIRED)
+ find_package(Lua 5.1 REQUIRED)
set(LUA_PREFERRED_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
set(LUA_PREFERRED_LIBRARIES ${LUA_LIBRARIES})
# Passive (not REQUIRED): if LUAJIT_FOUND is not set, nvim-test is skipped.
@@ -406,7 +414,7 @@ if(FEAT_TUI)
add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM)
endif()
- find_package(LibTermkey REQUIRED)
+ find_package(LibTermkey 0.18 REQUIRED)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
endif()
@@ -414,7 +422,7 @@ find_package(LibVterm REQUIRED)
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
if(WIN32)
- find_package(Winpty REQUIRED)
+ find_package(Winpty 0.4.3 REQUIRED)
include_directories(SYSTEM ${WINPTY_INCLUDE_DIRS})
endif()
@@ -425,11 +433,11 @@ option(CLANG_TSAN "Enable Clang thread sanitizer for nvim binary." OFF)
if((CLANG_ASAN_UBSAN AND CLANG_MSAN)
OR (CLANG_ASAN_UBSAN AND CLANG_TSAN)
OR (CLANG_MSAN AND CLANG_TSAN))
- message(FATAL_ERROR "Sanitizers cannot be enabled simultaneously.")
+ message(FATAL_ERROR "Sanitizers cannot be enabled simultaneously")
endif()
if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
- message(FATAL_ERROR "Sanitizers are only supported for Clang.")
+ message(FATAL_ERROR "Sanitizers are only supported for Clang")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD|FreeBSD|Windows") # see #5318
@@ -441,7 +449,7 @@ endif()
if(ENABLE_JEMALLOC)
if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN)
- message(STATUS "Sanitizers have been enabled; don't use jemalloc.")
+ message(STATUS "Sanitizers enabled; disabling jemalloc")
else()
find_package(JeMalloc REQUIRED)
include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIRS})
@@ -497,10 +505,10 @@ else()
endif()
if(NOT LUA_PRG_WORKS)
- message(FATAL_ERROR "A suitable Lua interpreter was not found.")
+ message(FATAL_ERROR "Failed to find a Lua 5.1-compatible interpreter")
endif()
-message(STATUS "Using the Lua interpreter ${LUA_PRG}.")
+message(STATUS "Using Lua interpreter: ${LUA_PRG}")
# Setup busted.
find_program(BUSTED_PRG NAMES busted busted.bat)