1

Following is the issue, I am encountering

  1. I have a shell script named my_script.sh.IN. I use configure_file for expanding script and thus creating my_script.sh.
  2. I then need to run my_script.sh. For this purpose, I am using execute_process().
  3. I need all of this at CMake time.

Issue: Problem is that when I run "cmake", system complains that he could not find "my_script.sh". I think that execute_process dependencies seem to be calculated before configure_file() function runs.

When I run "cmake" command second time, everything goes fine. Does anybody knows that how can I able to execute configure_file before execute_process?

1
  • Why does it needs to be done at cmake time? It would be much more easier to do it at compile time with add_custom_target / add_custom_command and a dependency on the my_script.sh file. Commented Nov 15, 2013 at 16:14

1 Answer 1

1

You should try something like that:

set_source_files_properties("pat/to/my_script.sh" PROPERTIES GENERATED true)

It tells cmake to not check the existency of the file too early. You will probably have to use the variable containing the path of your generated shell script instead of typing directly its path.

But your issue is more probably related to order of the executed cmake commands. You should ensure configure_file() is run BEFORE execute_process() by CMake parser.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.