Skip to content

Commit 1451b14

Browse files
committed
Align naming of FindTreeSitter cmake file and variables
`find_package(Foo ...)` expects to find a file FindFoo.cmake and the resulting variables to be named `Foo_...`. If those don't all match up, then the detection does not work properly. Closes neovim#13262
1 parent 42ffa2d commit 1451b14

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
374374
find_package(LibLUV 1.30.0 REQUIRED)
375375
include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS})
376376

377-
find_package(Treesitter REQUIRED)
378-
include_directories(SYSTEM ${TREESITTER_INCLUDE_DIRS})
377+
find_package(TreeSitter REQUIRED)
378+
include_directories(SYSTEM ${TreeSitter_INCLUDE_DIRS})
379379

380380
# Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
381381
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)

cmake/FindTreeSitter.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# - Try to find tree-sitter
2+
# Once done, this will define
3+
#
4+
# TreeSitter_FOUND - system has tree-sitter
5+
# TreeSitter_INCLUDE_DIRS - the tree-sitter include directories
6+
# TreeSitter_LIBRARIES - link these to use tree-sitter
7+
8+
include(LibFindMacros)
9+
10+
libfind_pkg_detect(TreeSitter tree-sitter FIND_PATH tree_sitter/api.h FIND_LIBRARY tree-sitter)
11+
libfind_process(TreeSitter)

cmake/FindTreesitter.cmake

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/nvim/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ list(APPEND NVIM_LINK_LIBRARIES
445445
${LIBTERMKEY_LIBRARIES}
446446
${UNIBILIUM_LIBRARIES}
447447
${UTF8PROC_LIBRARIES}
448-
${TREESITTER_LIBRARIES}
448+
${TreeSitter_LIBRARIES}
449449
${CMAKE_THREAD_LIBS_INIT}
450450
)
451451

0 commit comments

Comments
 (0)