emacs-libvterm icon indicating copy to clipboard operation
emacs-libvterm copied to clipboard

Error compile vterm-module and change reques for cmake 3.10 and target_include_directories(vterm-module ...)

Open bigopensky opened this issue 1 year ago • 0 comments

vterm-module does not compile on Ubuntu 18.04 cmake version 3.10.2

Analysis

/home/i4w/.emacs.d/elpa/vterm-20240102.1640
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.11 or higher is required.  You are running version 3.10.2

Changing CMakeLists.txt:1 to cmake_minimum_required(VERSION 3.10) leads to

/home/i4w/.emacs.d/elpa/vterm-20240102.1640
-- The C compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- No build type selected, defaulting to RelWithDebInfo
-- System libvterm detected
CMake Error at CMakeLists.txt:95 (target_include_directories):
  Cannot specify include directories for imported target "vterm"-- System libvterm detected

Configuration CMakeLists.txt:95 shows:

95:target_include_directories(vterm INTERFACE ${LIBVTERM_INCLUDE_DIR})

The target properties are set in CMakeLists.txt:13-18

set_target_properties(vterm-module PROPERTIES
  C_STANDARD 99
  C_VISIBILITY_PRESET "hidden"
  POSITION_INDEPENDENT_CODE ON
  PREFIX ""
  LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}
  )

and line CMakeLists.txt:94.

set_target_properties(vterm PROPERTIES IMPORTED_LOCATION ${LIBVTERM_LIBRARY})

The subsequent line

target_include_directories(vterm INTERFACE ${LIBVTERM_INCLUDE_DIR})

is not accepted by cmake and causing the error:.

CMake Error at CMakeLists.txt:95 (target_include_directories):
  Cannot specify include directories for imported target "vterm"-- System libvterm detected

Solution

Changing the target in line CMakeLists.txt:95 to vterm-module solves the problem.

target_include_directories(vterm-module INTERFACE ${LIBVTERM_INCLUDE_DIR})
/home/i4w/.emacs.d/elpa/vterm-20240102.1640
-- System libvterm detected
-- Configuring done
-- Generating done
-- Build files have been written to: /home/i4w/.emacs.d/elpa/vterm-20240102.1640/build
Scanning dependencies of target vterm-module
[ 25%] Building C object CMakeFiles/vterm-module.dir/vterm-module.c.o
[ 50%] Building C object CMakeFiles/vterm-module.dir/utf8.c.o
[ 75%] Building C object CMakeFiles/vterm-module.dir/elisp.c.o
[100%] Linking C shared module ../vterm-module.so
[100%] Built target vterm-module

I'm not a Crack in term of cmake, but is it possible to use cmake version 3.10? Is the successful running target vterm-module the right one?

Best regards Bigopensky

bigopensky avatar Feb 19 '24 16:02 bigopensky