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

  • Home
  • SEARCH
  • 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 6151673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:48:08+00:00 2026-05-23T19:48:08+00:00

I have a build script fragment that looks as follows: foreach(…) … add_custom_command( OUTPUT

  • 0

I have a build script fragment that looks as follows:

foreach(...)
...
  add_custom_command( OUTPUT ${fn_c} ${fn_s} ${fn_p_c} {fn_p_h}
                      COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --proto_path=${CMAKE_CURRENT_SOURCE_DIR}  ${CMAKE_CURRENT_SOURCE_DIR}/${proto_var} --cpp_out=. --plugin=protoc-gen-RBLRPC=${CMAKE_BINARY_DIR}/tools/protoc-gen-RBLRPC --RBLRPC_out=. 
                      DEPENDS ${proto_var}
  )

  if(${M_S_} OR ${M_C_})
    set(MARSHALL_RPC_FILES ${MARSHALL_RPC_FILES} ${fn_p_c})
    message(status "copy marshall -------------------")
    file(COPY ${CMAKE_CURRENT_BINARY_DIR}/${fn_c} 
              ${CMAKE_CURRENT_BINARY_DIR}/${fn_s} 
              ${CMAKE_CURRENT_BINARY_DIR}/${fn_p_h} DESTINATION ${CMAKE_SOURCE_DIR}/include/rpc/marshall)
  endif()
...
endforeach(...)

The copied files are not generated untill the custom comand is executed, however cmake attempts to copy the files upon first pass over the script. I’d welcome any suggestions to solve this problem , without drastically changing my scrips.

  • 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-23T19:48:08+00:00Added an answer on May 23, 2026 at 7:48 pm

    Don’t use file(COPY...) function, but add the following command to your add_custom_command:

    COMMAND ${CMAKE_COMMAND} copy ${CMAKE_CURRENT_BINARY_DIR}/${fn_c}
            ${CMAKE_SOURCE_DIR}/include/rpc/marshall
    

    But for what you’re going to do, I would suggest you keep your source tree clean, add directly use the generated files from the build directory. That would break, for instance, if you want to make two different build tree from a single source tree.

    edit :

    CMAKE_COMMAND is documented in the variable section of the online man-page documentation, (search for CMAKE_COMMAND and not ${CMAKE_COMMAND}.

    On the command line CMAKE -E will show you a list of portable commands useable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a build script and as part of that script it copies a
I have a build script where i create a text report file and output
Summary I currently have a NAnt build script that performs a vssget on either
We have an sql build script, with oracle 10.2. At the end of the
I'm currently experimenting with build script, and since I have an ASP.net Web Part
I've recently have a reason to include into our build script the creation of
I am modifying a Nant build script to run some unit tests. I have
I have a WPF project and I'm trying to setup a NAnt build script
G'day, We have a Perl script that is processing geolocation requests from the head-end
I have the following test defined in a psake build script: task package -depends

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.