-
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
Address FindTPL<tplName>.cmake inner find_package() calls finding TriBITS-installed <tplName>Config.camke files and add beginning of new examples '2' (#299, #427) #431
Merged
bartlettroscoe
merged 17 commits into
TriBITSPub:master
from
bartlettroscoe:299-427-find-package-install-dir
Nov 12, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…Config.cmake (TriBITSPub#299, TriBITSPub#427) This is one solution to the problem of finding <tplName>Config.cmake files in the CMAKE_INSTALL_PREFIX directory in the middile of a FindTpl<tplName>.cmake module. If you have to write a FindTpl<tplName>.cmake module, you are not expecting/wanting to find a TriBTIS-written <tplName>Config.cmake file. See the comment in TribitsProcessEnabledTpl.cmake for more details. This should fix the bug reported in TriBITSPub#427 where the find_package(HDF5 ...) call in FindTPLHDF5.cmake was finding HDF5Config.cmake in the install tree written by TriBITS in a previous installation. I am not sure this is the best solution to this problem but it has the advantage that we keep the <Package>Config.cmake files for external package and TriBITS package side-by-side. I suspect that I will implement another solution but at least this is a start to writing <tplName>ConfigVersion.cmake files.
…riBITSPub#299, TriBITSPub#427) This has two benefits: * It makes a distinction between <Package>Config.cmake files that are unique and created by the CMake project (and are put in <buildDir>/cmake_packages/ on installed under <installDir>/lib/cmake/) and those <tplName>Config.cmake files that are created by TriBITS to create standard targets needed to be used by downstream TriBITS projects. * It avoids find_package() from accidentally finding these TriBITS-generated <tplName>Config.cmake files in all contexts when <buildDir>/cmake_packages and <installDir> are added to CMAKE_PREFIX_PATH. This way, for example, downstream customer raw CMake projects will not accidentally find the TriBITS-generated HDF5Config.cmake when the Trilinos install dir is added to CMAKE_PREFIX_PATH. NOTE: This change is not needed to make the test TribitsExampleProject2_install_config_again pass due to commit: Write out <tplName>ConfigVersion.cmake and disallow finding <tplName>Config.cmake (TriBITSPub#299, TriBITSPub#427) but this makes it even more robust to not find these <tplName>Config.cmake files by accident.
… dirs and libraries (TriBITSPub#299)
This ensures that we keep the option to extract the include dirs and libraries to show that this can be an option as well and to test the function tribits_get_imported_location_property().
…ency() (TriBITSPub#299) As part of this, I had to move the logic to write the default version file <tplName>ConfigVersion.cmake to the calling function tribits_process_enabled_tpl() and moved the addition of the install targets there as well. Therefore, those commands will get called reguardless if tribits_tpl_find_include_dirs_and_libraries() gets called in the FindTPL<tplName>.cmake module or not. I also added a test for this case as well of course. But note that there are not tests that actually use the TplConfig[Version].cmake files yet. That will come next.
This was from a copy and paste that was left over and should have been taken out.
…BITSPub#299) These should be super simple given the purpose of this project.
…ITSPub#299) I also added error output for component find failure for <Project>Config.cmake files and a test to make sure it gets printed.
…TriBITSPub#299, TriBITSPub#427) This is the start for adding documentaiton for new <tplName>Config.cmake and <tplName>ConfigVersion.cmake files. It mentions a few issues that I felt were important enough to mention to TriBITS Project Developers and TriBITS Project Users.
f67960a
to
8fe2a49
Compare
I will go ahead and do the merge and any reviews can take place post-merge. I need to address a known problem with MS Windows and then get this PR added to the TriBITS snapshot for trilinos/Trilinos#9894. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR first adds a failing tests that basically reproduces the problems highlighted in bug report #427 in commit fb79c7f. The (what should be) super robust solution for this given in commits b4a6628 and b4a6628 and is is explained at the bottom of the TriBITS Users Guide section "How to use find_package() for a TriBITS TPL":
which is:
Also in this PR:
FindTPL<tplName>.cmake
file that writes a custom<tplName>Config.cmake
file that usesfind_dependency()
with<tplName>_DIR
set to find upstream external non-TriBITS package.find_pacakge(<Project> REQUIRED COMPONENTS <c0> <c1>)
describing what packages were not present when finding a project's<Project>Config.cmake
file with components and a test to ensure the right error message gets printed.TribitsExampleProject2
andTribitsExampleApp2
that will allow deeper testing with dependent TPLs so that I can finish implementing the move to modern CMake targets and stripping the old complex TriBITS logic (Move to modern CMake target-based propagation of build information #299).