0
我有一個項目中的一些elisp文件,我想用CMake進行字節編譯和安裝。編譯後,我想有一個目標將.el
和.elc
文件安裝到目錄。我至今是字節與CMake編譯elisp文件
set(ELISP_SOURCES
a.el.in
b.el
)
# Top level target to compile the elisp sources
add_custom_target(emacs_byte_compile ALL)
foreach(el ${ELISP_SOURCES})
# Configure and copy the files
get_filename_component(EL_NAME ${el} NAME_WE)
configure_file(${el} ${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.el)
# Add command to compile the files
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.elc
COMMAND ${EMACS} ARGS -batch -f batch-byte-compile ${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.el
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.el
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
# Create the dependencies
add_dependencies(emacs_byte_compile
${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.el ${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.elc
)
# Installation target
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.el ${CMAKE_CURRENT_BINARY_DIR}/${EL_NAME}.elc
RUNTIME DESTINATION ${ELISP_DIR}
)
endforeach(el)
當我配置具有cmake
(或ccmake
),然後運行make
,它不會編譯.el
文件。但它確實說它完成了目標emacs_byte_compile
。所以我假設我對這些依賴關係如何工作有些誤解。
完美!謝謝。 –