-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix find_package(<Package>) calls from TriBITS-generated <Package>Config.cmake files from different dirs (#299) #505
Comments
I was able to reproduce the error on 'hpws055' using the slightly simplified project:
with the project: where the files are:
Configuring this project gives:
|
So the situation is that SEACASNemeis has a direct dependency on SEACASExodus as shown by:
So I should be able to create a test in TriBITS that has a similar relationship and show this occuring. |
Thanks Ross for submitting this for me. We have a project currently not building because of this. |
@clintonstimpson, I will comment back here with status once I know more. Hopefully we can fix this quickly without having to modify your CMake project. (The thing working against us is that the standard way of writing |
TriBITSPub#505) This fixes the test added in the last commit for calling find_package() for related packages from different subdirs that was failing. I belive the problem is that the targets created by the CMake export() command don't have GLOBAL on them and only have directory scope. Therefore, we can't use include_guard(GLOBAL) because that will stop the creation of the imported targets in a different subdir where they are not defined.
…Tpl>::all_libs) (TriBITSPub#505) This change makes the IMPORTED targets produced by TriBITS for external packages/TPLs equivalent to those created by CMake export() in that they are **not** global but are just local to the directory where they are called. But to get ahead of the scalability problem, I added the guard: if (NOT TARGET <upstreamTpl>::all_libs) ... endif() around the find_dependency(<upstreamTpl> ...) calls.
Fix find_package() from separate subdirs for <Package>Config.cmake files (#505)
@gsjaardema, can you please update the TriBITS snapshot in the SEACAS repo? I think the PR #506 just merged will fix this bug reported by @clintonstimpson and documented above. |
FYI: @clintonstimpson confirmed in a separate email that after SEACAS updated its snapshot of TriBITS 'master', his use case now works. Closing this as complete. |
It was reported that the new TriBITS-generated
<Pacakge>Config.cmake
files don't work correctly when callingfind_package(<Package>)
from different directories for different packages that have a dependency relationship. This was reported from a SEACAS project customer that is trying to callfind_package()
from two different directories for two different SEACAS subpackages from that have a dependency. An small reproducer was provided:This has the directory structure:
The file
cmake-seacas-error/a/CMakeLists.txt
has:while the file
cmake-seacas-error/b/CMakeLists.txt
has:It is reported that the second call to
find_package(SEACASNemesis ...)
results in the error:This suggests a problem with how the new TriBITS-generated files are written using
include_guard(GLOBAL)
.The text was updated successfully, but these errors were encountered: