1

I have an external project that provides source files that I want to use to build an executable. I currently have something like the below:

ExternalProject(myproj)

add_executable(myexecutable source.c) # source.c is provided by myproj
add_depedencies(myexecutable myproj)

It errors and complains that it can't find source.c because it hasn't downloaded the external project yet. Is there a way to tell CMake that source.c comes from the external project?

0

2 Answers 2

1

I found a solution. Using add_custom_command I can tell CMake to get the external project first.

add_custom_command(OUTPUT source.c DEPENDS myproj COMMAND "")
Sign up to request clarification or add additional context in comments.

Comments

0

From https://stackoverflow.com/a/59794921/1203241

set_source_files_properties(source.c PROPERTIES GENERATED TRUE)

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.