-
Notifications
You must be signed in to change notification settings - Fork 543
CXX-2748 Disable generation of built tree targets file #1024
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4c79951
CXX-2748 Disable generation of build tree targets file
eramongodb b8f6dc1
Fix target of BSONCXX_STATIC compile definition for bsoncxx_add_libra…
eramongodb d340670
Fix find_dependency() specification in CMake package config files
eramongodb 0d4834c
Fix include directive for libbson and libmongoc headers
eramongodb 9c45434
CXX-2749 Unconditionally use <core/...> for mnmlstc/core headers
eramongodb a5bb151
Address ENABLE_AUTOMATIC_INIT_OR_CLEANUP warnings
eramongodb e456708
Fix path to build/hello_mongocxx
eramongodb e54ecb8
Merge remote-tracking branch 'upstream/master' into HEAD
eramongodb 8f15fce
Remove stray MONGOCXX project variable blocks
eramongodb 22a7aeb
Remove build tree targets file code entirely
eramongodb 248afa7
Update CHANGELOG with removal of build tree targets file
eramongodb 13ace6d
Tweak wording in CHANGELOG
eramongodb 5f01ab9
Document addition of find_dependency() in CHANGELOG
eramongodb 2c3bacc
Merge remote-tracking branch 'upstream/master' into cxx-2748
eramongodb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous
if(BSONCXX_BUILD_STATIC)
suggests the libbson package dependency is only needed when consuming the static bsoncxx target.With this changeset, this scenario appears to result in an error:
The C++ driver is configured with
-DBUILD_SHARED_AND_STATIC_LIBS=OFF
and installed.A test application links to the
mongocxx::mongocxx_shared
target:The test application is configured, setting
CMAKE_PREFIX_PATH
to the location of the C++ driver install (but not C driver install). This results in an error:This does not result in an error before the changeset.
Should the
if(BSONCXX_BUILD_STATIC)
be added back?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR's proposed changes deliberately produce that error.
Currently, the shared library dependency is being resolved via the dynamic linker by encoding the dependency in the shared library file's list of required shared libraries for symbol table resolution. However, this does not express/satisfy the library dependencies at the CMake project level, which can have an impact on certain platforms and CMake configurations.
This pre-PR behavior is discussed in this CMake issue:
However, the pre-PR behavior is arguably not ideal. Both pre-PR and post-PR, the CMake package targets file that is generated and installed for mongocxx includes the following command (for a release configuration; bsoncxx has symmetric content):
Without the addition of
find_dependency(mongoc-1.0 REQUIRED)
, the referencedmongo::mongoc_shared
target forIMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE
may never be resolved. Per CMake documentation:This is also acknowledged in the CMake issue linked above:
Note, at the moment, there is deliberately no warning on missing
find_dependency()
for a target inIMPORTED_LINK_DEPENDENT_LIBRARIES
as documented here:Ideally this call to
find_dependency()
would automatically be generated by CMake as part ofinstall(EXPORT)
for packages whose imported targets are depended on by a target exported by our CMake project (such asmongo::mongocxx_shared
->mongo::mongoc_shared
), but this feature is not yet implemented due to complexities concerning the "we don't know if that's a problem" problem. Therefore, it's currently our responsibility to ensurefind_dependency()
is present in the package config file for packages providing targets we depend on in our own exported targets.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation.