aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-05-13 12:12:29 +0200
committerGitHub <noreply@github.com>2023-05-13 12:12:29 +0200
commit10860164778327c0009f6efc8e020308cadb13a2 (patch)
tree735513c4c2943080f5e554e8699f623fe6ecea06 /cmake
parented8c44f76762061e30cb8056483f55d38802eaef (diff)
downloadrneovim-10860164778327c0009f6efc8e020308cadb13a2.tar.gz
rneovim-10860164778327c0009f6efc8e020308cadb13a2.tar.bz2
rneovim-10860164778327c0009f6efc8e020308cadb13a2.zip
build: cmake cleanup
- Simplify error checking when using execute_process. - Set BUILD_SHARED_LIBS to OFF when building dependencies. This is normally not needed, but msgpack interprets an unset BUILD_SHARED_LIBS to build a shared library, which is the opposite of the cmake behavior. - Move function check_lua_module to Util.cmake. - Remove unnecessary code. - Make variable naming more consistent
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ConvertPo.cmake2
-rw-r--r--cmake/FindLibluv.cmake14
-rw-r--r--cmake/FindLibuv.cmake8
-rw-r--r--cmake/FindLuajit.cmake3
-rw-r--r--cmake/FindLuv.cmake14
-rw-r--r--cmake/InstallHelpers.cmake3
-rw-r--r--cmake/LuaHelpers.cmake14
-rw-r--r--cmake/RunTests.cmake2
-rw-r--r--cmake/Util.cmake11
9 files changed, 28 insertions, 43 deletions
diff --git a/cmake/ConvertPo.cmake b/cmake/ConvertPo.cmake
index 2282b96f56..202cd3fbb3 100644
--- a/cmake/ConvertPo.cmake
+++ b/cmake/ConvertPo.cmake
@@ -6,7 +6,7 @@ execute_process(
OUTPUT_VARIABLE trans
ERROR_VARIABLE err
RESULT_VARIABLE res)
-if(NOT res EQUAL 0)
+if(res)
message(FATAL_ERROR "iconv failed to run correctly: ${err}")
endif()
diff --git a/cmake/FindLibluv.cmake b/cmake/FindLibluv.cmake
deleted file mode 100644
index d402b26447..0000000000
--- a/cmake/FindLibluv.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-find_path(LIBLUV_INCLUDE_DIR luv/luv.h)
-find_library(LIBLUV_LIBRARY NAMES luv_a luv libluv_a)
-
-# Ubuntu-specific workaround to find system paths
-function(ubuntu)
- set(CMAKE_FIND_LIBRARY_PREFIXES "")
- find_path(LIBLUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1)
- find_library(LIBLUV_LIBRARY NAMES luv PATH_SUFFIXES lua/5.1)
-endfunction()
-ubuntu()
-
-find_package_handle_standard_args(Libluv DEFAULT_MSG
- LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR)
-mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY)
diff --git a/cmake/FindLibuv.cmake b/cmake/FindLibuv.cmake
index 0cf8da3061..fa1d51370f 100644
--- a/cmake/FindLibuv.cmake
+++ b/cmake/FindLibuv.cmake
@@ -1,13 +1,7 @@
find_path(LIBUV_INCLUDE_DIR uv.h)
-
-list(APPEND LIBUV_NAMES uv_a uv)
-
-find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES})
+find_library(LIBUV_LIBRARY NAMES uv_a uv)
set(LIBUV_LIBRARIES ${LIBUV_LIBRARY})
-set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR})
-
-include(CheckLibraryExists)
check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL)
if(HAVE_LIBDL)
diff --git a/cmake/FindLuajit.cmake b/cmake/FindLuajit.cmake
index 924e4c80d4..711c2c0c09 100644
--- a/cmake/FindLuajit.cmake
+++ b/cmake/FindLuajit.cmake
@@ -11,9 +11,6 @@ endif()
find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES})
-set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY})
-set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR})
-
find_package_handle_standard_args(Luajit DEFAULT_MSG
LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR)
diff --git a/cmake/FindLuv.cmake b/cmake/FindLuv.cmake
new file mode 100644
index 0000000000..ebd74887ed
--- /dev/null
+++ b/cmake/FindLuv.cmake
@@ -0,0 +1,14 @@
+find_path(LUV_INCLUDE_DIR luv/luv.h)
+find_library(LUV_LIBRARY NAMES luv_a luv libluv_a)
+
+# Ubuntu-specific workaround to find system paths
+function(ubuntu)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "")
+ find_path(LUV_INCLUDE_DIR luv/luv.h PATH_SUFFIXES lua5.1)
+ find_library(LUV_LIBRARY NAMES luv PATH_SUFFIXES lua/5.1)
+endfunction()
+ubuntu()
+
+find_package_handle_standard_args(Luv DEFAULT_MSG
+ LUV_LIBRARY LUV_INCLUDE_DIR)
+mark_as_advanced(LUV_INCLUDE_DIR LUV_LIBRARY)
diff --git a/cmake/InstallHelpers.cmake b/cmake/InstallHelpers.cmake
index 49d8692aae..63bf2bb73b 100644
--- a/cmake/InstallHelpers.cmake
+++ b/cmake/InstallHelpers.cmake
@@ -7,9 +7,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "BSD" AND NOT DEFINED CMAKE_INSTALL_MANDIR)
endif()
endif()
-# For $CMAKE_INSTALL_{DATAROOT,MAN, ...}DIR
-include(GNUInstallDirs)
-
# This will create any directories that need to be created in the destination
# path with the typical owner, group, and user permissions--independent of the
# umask setting.
diff --git a/cmake/LuaHelpers.cmake b/cmake/LuaHelpers.cmake
deleted file mode 100644
index 00ecd1357f..0000000000
--- a/cmake/LuaHelpers.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Functions to help checking for a Lua interpreter
-#
-
-# Check if a module is available in Lua
-function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR)
- execute_process(COMMAND ${LUA_PRG_PATH} -l "${MODULE}" -e ""
- RESULT_VARIABLE module_missing)
- if(module_missing)
- set(${RESULT_VAR} False PARENT_SCOPE)
- else()
- set(${RESULT_VAR} True PARENT_SCOPE)
- endif()
-endfunction()
diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake
index fe346661b5..1dcb6fb373 100644
--- a/cmake/RunTests.cmake
+++ b/cmake/RunTests.cmake
@@ -82,7 +82,7 @@ execute_process(
file(GLOB RM_FILES ${BUILD_DIR}/Xtest_*)
file(REMOVE_RECURSE ${RM_FILES})
-if(NOT res EQUAL 0)
+if(res)
message(STATUS "Tests exited non-zero: ${res}")
if("${err}" STREQUAL "")
message(STATUS "No output to stderr.")
diff --git a/cmake/Util.cmake b/cmake/Util.cmake
index e15b44d29a..b70f33a302 100644
--- a/cmake/Util.cmake
+++ b/cmake/Util.cmake
@@ -193,3 +193,14 @@ function(set_default_buildtype)
endif()
endif()
endfunction()
+
+# Check if a module is available in Lua
+function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR)
+ execute_process(COMMAND ${LUA_PRG_PATH} -l "${MODULE}" -e ""
+ RESULT_VARIABLE module_missing)
+ if(module_missing)
+ set(${RESULT_VAR} FALSE PARENT_SCOPE)
+ else()
+ set(${RESULT_VAR} TRUE PARENT_SCOPE)
+ endif()
+endfunction()