Skip to content

Commit

Permalink
Add option to use emacs-module.h from system installed Emacs
Browse files Browse the repository at this point in the history
* Prefer to use system installed emacs-module.h header.
* Fallback to vendored header when it is not found.
* Enable the option by default.
* Fixes issue akermu#709.
  • Loading branch information
manphiz committed Sep 10, 2024
1 parent bc82d00 commit 2d28eea
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ else()
file(MAKE_DIRECTORY ${LIBVTERM_INCLUDE_DIR})
endif()

# Prefer system emacs-modules.h, usually from an Emacs installation.
option(USE_SYSTEM_EMACS_MODULE_HEADER
"Use system emacs-module.h instead of the vendored version." ON)

if (USE_SYSTEM_EMACS_MODULE_HEADER)
find_path(EMACS_MODULE_HEADER_DIR
NAMES emacs-module.h
)

# emacs-module.h found.
if (EMACS_MODULE_HEADER_DIR)
message(STATUS "System emacs-module.h detected")
target_include_directories(vterm-module PRIVATE ${EMACS_MODULE_HEADER_DIR})
else()
message(STATUS "System emacs-module.h not detected. Using vendored version.")
target_include_directories(vterm-module PRIVATE "${CMAKE_SOURCE_DIR}/vendor")
endif()
endif()

add_library(vterm STATIC IMPORTED)
set_target_properties(vterm PROPERTIES IMPORTED_LOCATION ${LIBVTERM_LIBRARY})
target_include_directories(vterm INTERFACE ${LIBVTERM_INCLUDE_DIR})
Expand Down

0 comments on commit 2d28eea

Please sign in to comment.