-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre-processor on unity file fails because it misses include directories from dependencies #160
Comments
We've hit this same issue, and would be very interested in any ideas to fix it! We've noticed that this issue only occurs on Linux. We don't see this problem on Windows. In a nutshell, cotire will not correctly inherit dependencies if you follow this pattern:
That make look strange, but the ability to define high level libraries before low level libraries is a fundamental feature in CMake for large codebases (with CMake targets defined throughout a multitude of subdirectories) It will work if you perform cotire last:
The problem is that this doesn't work when multiple directories are involved. Ideally we'd run cotire at the end of our processing (i.e. at the end of our root CMakeLists.txt file). However, calling cotire doesn't seem to work unless it's run from the same directory as the target. I haven't found any creative solutions to get around this that wouldn't require restructuring our codebase (which would be really unfortunate). |
@dethtoll1 I am experiencing the same issue, but on Windows. Here is some of my VS installation information:
Additionally, out of the box, it seems like because I am using sub-dependencies, I do not get a actual |
I'm in the same situation. Did anyone find a workaround for this issue? |
Suppose a CMake project with multiple libraries, sometimes depending on each other, and multiple executable linking to these libraries. To be concrete, suppose
libA
depending onlibD
. TheCMakeLists.txt
oflibA
reflects this relationship by having the linetaget_link_libraries(libA libD)
and I run cotire on both,libA
andlibD
, separately.Now, if
libA
is processed beforelibD
, thenlibD
is not yet aTARGET
for CMake, becauseadd_library(libD ...)
was not yet called, whencotire(libA)
is called. In that case, when runningfor
libA
,will add
libD
to_librariesToProcess
, but in the subsequentwhile
-loop,if( TARGET ${_library} )
will returnfalse
forlibD
, because CMake does not yet know thelibD
as aTARGET
. The dependencylibD
is therefore discarded and not added to_targetRequirements
. Is there any way to work around this problem?The problem started from here: I cotired
libA
without unity build. This runs through, but it emits a warning likeand looking at the log file it would say
So, it correctly create the unity source for
libA
, but then fails while running the pre-processor on these cpp files to get a list of all headers. And the pre-processor fails because it misses the include directories tolibD
, becauselibD
was dropped as dependency as described above.The text was updated successfully, but these errors were encountered: