admin管理员组

文章数量:1405191

On my system I have Emacs:

$ which emacs
/usr/bin/emacs
$ emacs --version
GNU Emacs 29.4

I cannot make CMake find it; this is the corresponding bit of CMakeLists.txt file:

find_program(EMACS emacs)
message(STATUS "EMACS=${EMACS}")
if(EMACS_FOUND)
    execute_process(COMMAND ${EMACS_EXECUTABLE} ./text --batch -f -latex-export-to-pdf --kill
                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                    RESULT_VARIABLE EMACS_RESULT)
    if(NOT EMACS_RESULT EQUAL "0")
        message(WARNING "Emacs error: ${EMACS_RESULT} - cannot generate documentation.")
    endif()
else()
    message(WARNING "Emacs not found: cannot generate documentation.")
endif()

This is the output running from the IDE (KDevelop):

-- EMACS=EMACS-NOTFOUND
CMake Warning at CMakeLists.txt:65 (message):
  Emacs not found: cannot generate documentation.

This is the output running from the command line (Bash):

-- EMACS=/usr/bin/emacs
CMake Warning at CMakeLists.txt:65 (message):
  Emacs not found: cannot generate documentation.

What am I doing wrong?

本文标签: CMake does not find an external executable (Emacs)Stack Overflow