-
Notifications
You must be signed in to change notification settings - Fork 186
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
WIP: Fix bug/behaivor in imported targets via PkgConfig:: #139
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,17 @@ function(hunter_pkgconfig_export_target PKG_CONFIG_MODULE PKG_GENERATE_SHARED) | |
if(TARGET "${target_name}") | ||
return() | ||
endif() | ||
|
||
if(${PKG_CONFIG_MODULE}_FOUND) | ||
file(READ "${CMAKE_BINARY_DIR}/_3rdParty/Hunter/install-root-dir" HUNTER_INSTALL_ROOT_DIR) | ||
list(APPEND _copy_of_${PKG_CONFIG_MODULE}_LIBRARY_DIRS "${PKG_CONFIG_MODULE}_LIBRARY_DIRS") | ||
list(FILTER _copy_of_${PKG_CONFIG_MODULE}_LIBRARY_DIRS EXCLUDE REGEX "${HUNTER_INSTALL_ROOT_DIR}") | ||
list(LENGTH _copy_of_${PKG_CONFIG_MODULE}_LIBRARY_DIRS _list_length) | ||
if(_list_length GREATER 0) | ||
message(SEND_ERROR "CMakeCache entries for ${PKG_CONFIG_MODULE}_LIBRARY_DIRS points to ${${PKG_CONFIG_MODULE}_LIBRARY_DIRS} but the current hunter install root dir is ${HUNTER_INSTALL_ROOT_DIR}\nYou should verify and change/remove all wrong cache entries or delete your CMakeCache.txt in your build folder!") | ||
endif() | ||
endif() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly I'm not sure I understand the issue still. In my experience CMake basically requires you bin your build tree (at least you CMakeCache.txt) when you change any libraries, which would include libraries changed by Hunter after a Hunter upgrade. If that is the thing you are trying to fix then I imagine it happens with non-pkgconfig libraries too? Maybe @rbsheth will have more of a clear idea? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I don't have a clear idea. 😄 Based on the error description, it seems like using pkgconfig targets screws up CMake somehow and does not "refresh" the target if the version has changed. Wouldn't it be better to force a refresh somehow? This message is basically telling the user to nuke their CMakeCache, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometime an example say more than thousand words ;-) Do following ... Clone my example:
Then checkout:
Build the project .... after all is fine execute the
So no surprise ... :-) Keep eyes on following cmake output:
Now we update the botan version from 2.10.0 to 2.11.0-110af9494 .... checkout out ...
Now build the project again for example Hunter will build botan version 2.11.0-110af9494 and you see also following cmake output like:
So all looks fine, but when you execute Version: Botan 2.10.0 (unreleased, revision unknown, distribution unspecified) If you verify the output from
You see .... botan-2_LIBRARY_DIRS is still pointing to the "build" before ... this is really bad and nobody will see this! This happen, because if You can test my solution ... checkout
Now you will get the error message (again should be more "proper"). As @hjmallon comment all the FindX.cmake working somehow with Anyway, I will verify if there are more "pitfalls" for example with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, thanks for the detailed explanation. I see what is going on now. Is this PR still WIP? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rbsheth Yes, still WIP, since I will check whether the "find_package ()" is also affected. Then I want to try to check "this" in "hunter_finalize ()" ... that's my plan. I'm trying to get ready this week |
||
pkg_check_modules(${PKG_CONFIG_MODULE} ${PKG_CONFIG_MODULE}) | ||
if(NOT ${PKG_CONFIG_MODULE}_FOUND) | ||
hunter_internal_error( | ||
|
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 error message should be "corrected" ... I only write "something" ...