Skip to content

Commit

Permalink
build: make lpeg an imported library
Browse files Browse the repository at this point in the history
Cmake truncates the full link path to a shared library if it is missing
an SONAME in some undocumented scenarios. This causes builds in some
systems to fail if "lpeg" isn't a library on the system path.

The path of imported libraries aren't modified by cmake, so we can use
that as a workaround until a proper solution for this has been
identified.

Closes neovim#23395.
  • Loading branch information
dundargoc authored Apr 30, 2023
1 parent 066db5e commit 9f9cef1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmake/FindLpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ ubuntu()
find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY)
mark_as_advanced(LPEG_LIBRARY)

add_library(lpeg INTERFACE)
target_link_libraries(lpeg INTERFACE ${LPEG_LIBRARY})
# Workaround: use an imported library to prevent cmake from modifying library
# link path. See #23395.
add_library(lpeg UNKNOWN IMPORTED)
set_target_properties(lpeg PROPERTIES IMPORTED_LOCATION ${LPEG_LIBRARY})

0 comments on commit 9f9cef1

Please sign in to comment.