aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 11 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index caf9658699..6a25e1de8d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,17 +1,12 @@
# CMAKE REFERENCE
# intro: https://codingnest.com/basic-cmake/
# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
+# pitfalls: https://izzys.casa/2019/02/everything-you-never-wanted-to-know-about-cmake/
# Version should match the tested CMAKE_URL in .github/workflows/ci.yml.
cmake_minimum_required(VERSION 3.10)
project(nvim C)
-if(POLICY CMP0065)
- cmake_policy(SET CMP0065 NEW)
-endif()
-if(POLICY CMP0060)
- cmake_policy(SET CMP0060 NEW)
-endif()
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()
@@ -102,7 +97,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Work around some old, broken detection by CMake for knowing when to use the
# isystem flag. Apple's compilers have supported this for quite some time
# now.
- if(CMAKE_COMPILER_IS_GNUCC)
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU")
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
endif()
endif()
@@ -127,40 +122,28 @@ endif()
message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
-# Build type.
-if(NOT CMAKE_BUILD_TYPE)
- message(STATUS "CMAKE_BUILD_TYPE not specified, default is 'Debug'")
- set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
-else()
- message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
-endif()
+set_default_buildtype()
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(DEBUG 1)
else()
set(DEBUG 0)
endif()
-# Set available build types for CMake GUIs.
-# Other build types can still be set by -DCMAKE_BUILD_TYPE=...
-set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
- STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
# If not in a git repo (e.g., a tarball) these tokens define the complete
# version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
-set(NVIM_VERSION_MINOR 8)
+set(NVIM_VERSION_MINOR 9)
set(NVIM_VERSION_PATCH 0)
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
# API level
set(NVIM_API_LEVEL 10) # Bump this after any API change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
-set(NVIM_API_PRERELEASE true)
+set(NVIM_API_PRERELEASE false)
set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
# NVIM_VERSION_CFLAGS set further below.
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-
# Log level (MIN_LOG_LEVEL in log.h)
if("${MIN_LOG_LEVEL}" MATCHES "^$")
# Minimize logging for release-type builds.
@@ -186,7 +169,7 @@ if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
-if(CMAKE_COMPILER_IS_GNUCC)
+if(CMAKE_C_COMPILER_ID MATCHES "GNU")
check_c_compiler_flag(-Og HAS_OG_FLAG)
else()
set(HAS_OG_FLAG 0)
@@ -289,7 +272,7 @@ if(MSVC)
# XXX: /W4 gives too many warnings. #3241
add_compile_options(/W3)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
- add_definitions(-DWIN32)
+ add_definitions(-DMSWIN)
else()
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion
@@ -336,6 +319,7 @@ endif()
if(MINGW)
# Use POSIX compatible stdio in Mingw
add_definitions(-D__USE_MINGW_ANSI_STDIO)
+ add_definitions(-DMSWIN)
endif()
if(WIN32)
# Windows Vista is the minimum supported version
@@ -513,11 +497,11 @@ if(FEAT_TUI)
add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM)
endif()
- find_package(LibTermkey 0.18 REQUIRED)
+ find_package(LibTermkey 0.22 REQUIRED)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
endif()
-find_package(LIBVTERM 0.1 REQUIRED)
+find_package(LIBVTERM 0.3 REQUIRED)
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF)
@@ -654,6 +638,7 @@ include(InstallHelpers)
add_glob_targets(
TARGET lintpy
COMMAND ${FLAKE8_PRG}
+ FLAGS --max-line-length 100
GLOB_DIRS contrib scripts src test
GLOB_PAT *.py
TOUCH_STRATEGY SINGLE