Some polishing for the cmake ReSVG discovery #187
Merged
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.
find_package_handle_standard_argsis supposed to set the_FOUNDvariable automatically (as the comment right above it says), as well as handling things likeREQUIRED,QUIETLY, etc. It should always be run at the end of a module, for this reason.This change removes the conditionals around the call, lets it handle what it's meant to handle, and defines a custom failure message for discovery that replaces the manual one in
src/CMakeList.txt.In addition, the
REQUIREDis removed fromtests/CMakeLists.txt, since it's supposed to mark the module as required (which ReSVG is not), and was only working due to the aforementioned improperconditional wrapping of the module's cleanup.
With these changes, on my system libopenshot still builds and
make teststill runs successfully both with and without ReSVG being discovered.Additionally, if only one of the two parts is missing, cmake will automatically indicate that in the failure message:
The message correctly indicates that only
RESVG_LIBRARYwas not found, becauseRESVG_INCLUDE_DIRwas still successfully discovered as/tmp/resvg/target/release/include/.Also:
$ENV{RESVGDIR}is added to the search list forfind_path( RESVG_LIBRARY..., so that copying/linking theincludedir intotarget/release/and runningRESVGDIR=/path/to/resvg/target/release/ cmake ...will successfully discover the libraryFindRESVG.cmakeclaiming it setsRESVG_DEFINITIONSis removed, because it doesn't