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 6821951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:36:20+00:00 2026-05-26T21:36:20+00:00

When I use the classic gnu Make I put in post build actions like

  • 0

When I use the classic gnu Make I put in post build actions like flash the device (if it is a embedded device) and other similiar actions. The actual flashing is usually hidden behind a little sctipt or some commands.

Then I can type something like

make flash

so I first build the code and then it ends up on the target.
The classic Makefile could have something like in it:

.PHONY: flash
flash: main.bin
    scripts/do_flash.pl main.bin

But how do I add this kind of post build actions to a cmake build?

How do I add a “custom command” that just executes a shellscript?

This questions talks about add_custom_command:
The question cmake add custom command feels like it is close,
but the add_custom_command seems to need a “output file” to work.
But in this case there is something happening, not generated.

What would I put in the CMakeLists.txt to add such a custom action?

/Thanks


For reference, a link into the cmake documentation on this topic

  • http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_custom_target
  • 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-05-26T21:36:20+00:00Added an answer on May 26, 2026 at 9:36 pm

    Try this:

    add_custom_target(flash
        COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/do_flash.pl ${MAIN_BIN_FILE}
        DEPENDS ${MAIN_BIN_FILE}
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a classic ASP forum, I'd like to use a master page and
Like the topic says, can ASP Classic use registration free components? This is on
I use an asp (classic) utility file to create json objects from an SQL
What should i use to code Classic ASP under Linux. I have really tried
I'm creating a GUID for use in a Classic ASP application, by using TypeLib.
Apparantly when users right-click in our WPF application, and they use the Windows Classic
I have to use the XMLHttp object in classic ASP in order to send
Is there a command in classic ASP I can use to tell the browser
I'm trying to evaluate whether to use classic Principal based authorization vs. IdentityModel authorization.
Due to a customer requirement I am forced to use classic ASP, so I

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.