CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. set(EMACS_LISP_SOURCES
  2. ledger-commodities.el
  3. ledger-complete.el
  4. ledger-exec.el
  5. ledger-fontify.el
  6. ledger-fonts.el
  7. ledger-fontify.el
  8. ledger-init.el
  9. ledger-mode.el
  10. ledger-navigate.el
  11. ledger-occur.el
  12. ledger-post.el
  13. ledger-reconcile.el
  14. ledger-regex.el
  15. ledger-report.el
  16. ledger-schedule.el
  17. ledger-sort.el
  18. ledger-state.el
  19. ledger-test.el
  20. ledger-texi.el
  21. ledger-xact.el)
  22. set(EMACS_LISP_SOURCES_UNCOMPILABLE
  23. ledger-context.el)
  24. # find emacs and complain if not found
  25. find_program(EMACS_EXECUTABLE emacs)
  26. macro(add_emacs_lisp_target el)
  27. configure_file(${el} ${CMAKE_CURRENT_BINARY_DIR}/${el})
  28. # add rule (i.e. command) how to generate the byte-compiled file
  29. add_custom_command(
  30. OUTPUT ${el}c
  31. COMMAND ${EMACS_EXECUTABLE}
  32. -L ${CMAKE_CURRENT_BINARY_DIR}
  33. -l ${CMAKE_CURRENT_BINARY_DIR}/ledger-regex.el
  34. -batch -f batch-byte-compile
  35. ${CMAKE_CURRENT_BINARY_DIR}/${el}
  36. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${el}
  37. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  38. COMMENT "Creating byte-compiled Emacs lisp ${CMAKE_CURRENT_BINARY_DIR}/${el}c")
  39. endmacro(add_emacs_lisp_target el)
  40. if (EMACS_EXECUTABLE)
  41. # uncompilable .el files
  42. foreach(el ${EMACS_LISP_SOURCES_UNCOMPILABLE})
  43. configure_file(${el} ${CMAKE_CURRENT_BINARY_DIR}/${el})
  44. list(APPEND EMACS_LISP_UNCOMPILABLE ${CMAKE_CURRENT_BINARY_DIR}/${el})
  45. endforeach()
  46. # compilable .el files
  47. foreach(el ${EMACS_LISP_SOURCES})
  48. add_emacs_lisp_target(${el})
  49. list(APPEND EMACS_LISP_BINARIES ${CMAKE_CURRENT_BINARY_DIR}/${el}c)
  50. endforeach()
  51. add_custom_target(emacs_lisp_byte_compile ALL DEPENDS ${EMACS_LISP_BINARIES})
  52. # install the byte-compiled emacs-lisp sources
  53. install(FILES ${EMACS_LISP_SOURCES} ${EMACS_LISP_BINARIES} ${EMACS_LISP_UNCOMPILABLE}
  54. DESTINATION share/emacs/site-lisp/ledger-mode)
  55. endif()
  56. ### CMakeLists.txt ends here