Use recommended case for variable names. i.e. matching name of the
module as passed to `find_package`.
For backwards compatibility, the upper case versions of both input and
output variables are used and defined when appropriate. Skip this for
the _FOUND variable because FPHSA already does it. Skip this for the
_VERSION variable because that was recently added and never available
with the old name in a release of CMake.
Also detect the library version number. Provide results as variables
and as an imported target, LTTng::UST.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Check found libraries version to match user required version.
Protobuf compiler executable version is checked to be aligned with found
libraries, raising a warning message otherwise.
The FindKDE4 module (incorrectly) modifies CMAKE_MODULE_PATH on the
caller's behalf. This causes KDE4-installed find modules to be used by
the test instead of those in CMake. Teach the test to restore the
CMAKE_MODULE_PATH to its original value after each find_package call.
This ensures that the next find_package actually tests our module.
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block. This is no longer the preferred style.
Run the following shell code:
for c in else endif endforeach endfunction endmacro endwhile; do
echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
Our only expectation of version number variables should be that
they begin with a decimal digit for VERSION_LESS, VERSION_EQUAL
and VERSION_GREATER comparison purposes. If people put extra
blah blah after a version number like "1.2.3 (this is some super
special extra information about our funky proprietary build of
the official 1.2.3 release)" then we should be ok with that.
So: now we have the following expectations for version number
variable content for the purposes of the AllFindModules test:
- it should start with a decimal digit (match "^[0-9]")
- it should not be empty
- it should not be VERSION_EQUAL 0
- it should not be NOT VERSION_GREATER 0
For all current build machines the modules FindPkgConfig, FindFreetype, and
FindLibXslt return a version number. Enforce this to early catch when this
is not always the case.