From bc82d001f5a37f4467ad2b52872b738b16f5b061 Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Tue, 10 Sep 2024 00:25:36 -0700 Subject: [PATCH 1/2] Move emacs-module.h to vendor directory * This prevents the vendored header to be used by default. --- emacs-module.h => vendor/emacs-module.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename emacs-module.h => vendor/emacs-module.h (100%) diff --git a/emacs-module.h b/vendor/emacs-module.h similarity index 100% rename from emacs-module.h rename to vendor/emacs-module.h From 2d28eea68046b4c112400baf491d457a46593c51 Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Tue, 10 Sep 2024 03:08:00 -0700 Subject: [PATCH 2/2] Add option to use emacs-module.h from system installed Emacs * 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 #709. --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4917264c..ce595706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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})