Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7885389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:03:21+00:00 2026-06-03T05:03:21+00:00

I have some elisp files in a project that I want to byte compile

  • 0

I have some elisp files in a project that I want to byte compile and install with CMake. After compilation I want to have a target to install the .el and .elc files to a directory. What I have so far is

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)

When I configure with cmake (or ccmake) and then run make, it doesn’t compile the .el files. It does however say that it finished building the target emacs_byte_compile. So I assume I have some misunderstanding as to how the dependencies work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:03:23+00:00Added an answer on June 3, 2026 at 5:03 am

    You need to create a top level target that consumes the output of the custom command you created. You can find some ideas here: http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F

    The add_dependencies command is only useful for connecting top level cmake targets, so that line is not doing anything.

    Something like this:

    foreach(el ..)
      # collect output files into a list
      # create a custom command to run emacs to create the elc, 
      #input is .el output is .elc
    endforeach()
    add_custom_target(emacs_byte_compile DEPENDS ${ELC_LIST})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a elisp script for Emacs that I want to do some clean
I have some files that are uuencoded, and I need to decode them, using
Have some data in a sybase image type column that I want to use
Have some audio and video files that users are to download, however depending on
I have some files stored at amazon. all in private mode, and since I
I have some script in my default page that redirects users to language specific
I have some interesting problem for an hour.. In my flex project, all width
I have some jquery code that is doing an ajax lookup and returning comma
I'm trying to write some Elisp code to format a bunch of legacy files.
In a nutshell , I want to have different faces for some types of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.