Issue
I am embedding a source file into another source file using inline assembly and .incbin, which is just like I want it. I will not accept the standard objcopy method, which while works is (imho) the lesser method. xxd is also an option, but really only for very small includes. I have a static site builder that takes a lot of resources and packs it into a single program, which is very quick with .incbin.
Unfortunately, adding the JS file to the list of sources is not enough:
ninja explain: output CMakeFiles/jsapp.dir/static_site.c.o older than most recent input static_site.c (1629797306094133842 vs 1629797311521966739)
ninja explain: CMakeFiles/jsapp.dir/static_site.c.o is dirty
ninja explain: jsapp is dirty
[2/2] Linking C executable jsapp
The main C file that embeds the JS is not being rebuilt, but the static site source which is unrelated here is because the timestamp changed.
How can I tell CMake that source.c now depends on some_file.js?
Solution
As per @arrowd 's idea:
set_source_files_properties(main.c OBJECT_DEPENDS
${CMAKE_SOURCE_DIR}/my.js
)
Worked beautifully.
Answered By - gonzo Answer Checked By - Cary Denson (WPSolving Admin)