I have a target hello
with two source files a.cpp
and b.cpp
. And both contain the #import
directive:
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile")
which will generate the header file msado15.tlh
during compilation.
Ninja builds source files in parallel which causes race on the header file generation.
This is related to Developer Community.
I tried OBJECT_DEPENDS
, it worked well, but the path to the output object file is implementation detail.
set_source_files_properties(b.cpp PROPERTIES OBJECT_DEPENDS "CMakeFiles/hello.dir/a.cpp.obj")
Using PCH should work also. But is there an official way to make a source file compile before any others?