-
Notifications
You must be signed in to change notification settings - Fork 281
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
Add a cmake config file export #2703
Conversation
cmake/exiv2Config.cmake.in
Outdated
cmake_minimum_required(VERSION 3.16.3) | ||
include(CMakeFindDependencyMacro) | ||
|
||
find_dependency(ZLIB REQUIRED) |
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 is the find dependency call I mentioned that was missing. This should only be added to the generated file if it was built with PNG support.
Here is one approach:
https://discourse.cmake.org/t/installing-exporting-projects-that-conditionally-use-optional-dependencies/5194/2
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.
I used this approach. With EXIV2_ENABLE_PNG
turned on, the following config file gets generated:
cmake_minimum_required(VERSION 3.16.3)
include(CMakeFindDependencyMacro)
if(ON) # if(EXIV2_ENABLE_PNG)
find_dependency(ZLIB REQUIRED)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/exiv2Export.cmake")
check_required_components(exiv2)
f6a85fb
to
793e872
Compare
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
install(TARGETS exiv2lib EXPORT exiv2Export) |
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.
In CMake 3.14 and above, you don't need to supply the RUNTIME, LIBRARY, and ARCHIVE directories. This relies on the defaults, which conveniently were the same as before.
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.
As CMake was reduced to 3.5, is this still relevant?
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.
Yup! This cmake version required to build
exiv2 is 3.16.3
which is when this line of code runs. This version is unchanged in this PR.
The version required to consume
exiv2 is now 3.5
. Previously, no such minimum version was specified, it was undefined.
They are independent.
793e872
to
744de24
Compare
Codecov Report
@@ Coverage Diff @@
## main #2703 +/- ##
=======================================
Coverage 63.91% 63.91%
=======================================
Files 103 103
Lines 22313 22313
Branches 10804 10804
=======================================
Hits 14261 14261
Misses 5828 5828
Partials 2224 2224 |
I'll just mention in passing that a recent big endian bug that got fixed I tested on cfarm's GCC230, which has
although buster-backports has 3.18.4 , so probably better to update to that. |
You are right, I could probably downgrade the installation version of cmake, probably to 3.5. None of the logic in there is new. |
Is this PR in the right direction you were hoping? If so, aside from the part about making |
Sure. This is still a draft. |
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
744de24
to
d798697
Compare
* This matches an alias target name * Recommend using the namespaced target in the README Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Downgraded to 3.5 in 2d3b05c |
Should this be backported? |
Yes please, it's affecting us on the last release and we are maintaining a patch in exiv2 internally. I did my best to ensure it's backwards compatible. |
@Mergifyio backport 0.28.x |
✅ Backports have been created
|
this PR seems to have caused Windows CI to fail:
Interestingly enough, the CI here didn't catch it but the one on push did. |
It's been brought to my attention this somehow broke the windows build due to a linker error.
What is not clear is how these changes caused a linker failure, AND how they were not caught by CI in this PR. I'll try to set up a Windows computer, but it might take a few days. I would suggest a temporary revert if you are sure the regression was actually caused by this PR. |
I’m just looking at main, which commits are green and red. The last one is red. No idea what the issue is. |
Ok. I have installed Visual Studio on a Windows computer. I'll try to reproduce it locally. |
Update - The conan installation and build instructions for Windows don't work, I can't yet compile exiv2. |
A revert for this PR is added here: #2725 |
This is an example of the path forward for #2687 . More work will be required for all the dependencies, and propagating the build options such as
EXIV2_ENABLE_PNG
to add/remove find_dependency calls.Edit: All actions are complete in scope of the original issue.
Note: This work was done on behalf of AeroVironment Inc.