aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-08-12 18:22:02 +0200
committerGitHub <noreply@github.com>2019-08-12 18:22:02 +0200
commit90e44ecf1144cb32195da00e24d23afb111ea680 (patch)
tree960db6b024a3d41bb27ba63776dfa3a60e7deac0
parenta336a05e7e4aab5a7b5e21a676f5531fd6a3fd35 (diff)
downloadrneovim-90e44ecf1144cb32195da00e24d23afb111ea680.tar.gz
rneovim-90e44ecf1144cb32195da00e24d23afb111ea680.tar.bz2
rneovim-90e44ecf1144cb32195da00e24d23afb111ea680.zip
build: link libraries by full path (for luv.so) (#10661)
Use "luv" as imported library to work around "-lluv" being used due to missing SONAME. Fixes https://github.com/neovim/neovim/issues/10407. Ref: https://gitlab.kitware.com/cmake/cmake/issues/19578 Ref: https://github.com/NixOS/nixpkgs/issues/64400#issuecomment-516557253
-rw-r--r--cmake/FindLibLUV.cmake3
-rw-r--r--src/nvim/CMakeLists.txt8
2 files changed, 9 insertions, 2 deletions
diff --git a/cmake/FindLibLUV.cmake b/cmake/FindLibLUV.cmake
index 784e3fd249..bc53d00f24 100644
--- a/cmake/FindLibLUV.cmake
+++ b/cmake/FindLibLUV.cmake
@@ -14,7 +14,8 @@ set(LIBLUV_DEFINITIONS ${PC_LIBLUV_CFLAGS_OTHER})
find_path(LIBLUV_INCLUDE_DIR luv/luv.h
PATHS ${PC_LIBLUV_INCLUDEDIR} ${PC_LIBLUV_INCLUDE_DIRS})
-list(APPEND LIBLUV_NAMES luv)
+# Explicitly look for luv.so. #10407
+list(APPEND LIBLUV_NAMES luv luv${CMAKE_SHARED_LIBRARY_SUFFIX})
find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}
HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS})
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 0fc7c780ca..22f3153230 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -381,9 +381,14 @@ if(WIN32)
list(APPEND NVIM_LINK_LIBRARIES ${WINPTY_LIBRARIES})
endif()
+# Use "luv" as imported library, to work around CMake using "-lluv" for
+# "luv.so". #10407
+add_library(luv UNKNOWN IMPORTED)
+set_property(TARGET luv PROPERTY IMPORTED_LOCATION ${LIBLUV_LIBRARIES})
+
# Put these last on the link line, since multiple things may depend on them.
list(APPEND NVIM_LINK_LIBRARIES
- ${LIBLUV_LIBRARIES}
+ luv
${LIBUV_LIBRARIES}
${MSGPACK_LIBRARIES}
${LIBVTERM_LIBRARIES}
@@ -401,6 +406,7 @@ endif()
set(NVIM_EXEC_LINK_LIBRARIES ${NVIM_LINK_LIBRARIES} ${LUA_PREFERRED_LIBRARIES})
+# Add IPO flags (for LTO), or error if CMake does not know the flags. #8654
if(POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()