Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / editors / scel / el / CMakeLists.txt
blobdbc0a5fb415a5272aff6cb036c2d58810790bdd1
1 option(SC_EL_BYTECOMPILE "Build emacs-based IDE." ON)
2 mark_as_advanced(SC_EL_BYTECOMPILE)
4 file(GLOB scel_sources
5          RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.el)
7 set(PKG_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/SuperCollider)
9 configure_file(sclang-vars.el.in
10                            ${CMAKE_CURRENT_BINARY_DIR}/sclang-vars.el)
12 foreach (el ${scel_sources})
13         configure_file(${el} ${CMAKE_CURRENT_BINARY_DIR}/${el})
14 endforeach()
16 set(all_scel_sources ${scel_sources} sclang-vars.el)
18 if (SC_EL_BYTECOMPILE)
19         find_program(EMACS_EXECUTABLE emacs)
20         if(NOT EMACS_EXECUTABLE)
21                 message(SEND_ERROR "Emacs could not be found.\n (If emacs interface is not required, then set SC_EL=no)")
22         endif()
24         foreach (el ${all_scel_sources})
25                 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${el}c
26                         COMMAND ${EMACS_EXECUTABLE} -batch
27                                 -L ${CMAKE_CURRENT_BINARY_DIR}
28                                 -f batch-byte-compile
29                                 ${CMAKE_CURRENT_BINARY_DIR}/${el}
30                         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${el}
31                         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
32                         COMMENT "Creating byte-compiled Emacs lisp ${CMAKE_CURRENT_BINARY_DIR}/${el}c")
34                 add_custom_target(${el}c ALL
35                 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${el}c)
37                 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${el}c
38                 DESTINATION share/emacs/site-lisp/SuperCollider)
39         endforeach()
40 else()
41         install (FILES ${scel_sources} ${CMAKE_CURRENT_BINARY_DIR}/sclang-vars.el
42                         DESTINATION share/emacs/site-lisp/SuperCollider)
43 endif()