find_package helpers for polysquare cmake tooling scripts.
| Travis CI (Ubuntu) | AppVeyor (Windows) | Coverage | Biicode | Licence |
|---|---|---|---|---|
tooling-find-pkg-util wraps FindPackageHandleStandardArgs
in relation to source code tooling binaries. It provides functions to
extract the path and version of those binaries (and thus whether they
are installed) and a means to pass that information to
FindPackageHandleStandardArgs.
Finds the executable EXECUTABLE_TO_FIND and places the result in PATH_RETURN.
This information can later be passed to psq_check_and_report_tool_version. It
will check both the system installation paths and any provided CUSTOM_PATHS.
EXECUTABLE_TO_FIND: The name of the executable to findPATH_RETURN: A variable to place the full path when found- [Optional]
CUSTOM_PATHS: Paths to search first before searching system paths - [Optional]
PATH_SUFFIXES: Suffixes on each installation root (eg, bin)
Runs the tool and fetches its version, placing the result into VERSION_RETURN.
This information can later be passed to psq_check_and_report_tool_version.
Usually the version number is printed along with other information. As such
you should specify VERSION_HEADER and VERSION_END_TOKEN to indicate any
text that should be removed in the string before the version number and a
token which occurs indicating that the end of the version number has been
reached.
TOOL_EXECUTABLE: The path to the toolVERSION_RETURN: A variable to place the full version when detected- [Optional]
VERSION_ARG: Argument to pass to the tool when running it to fetch its version. - [Optional]
VERSION_HEADER: Text that comes before the version number. - [Optional]
VERSION_END_TOKEN: Text that comes after the version number.
For the package specified by PREFIX, determines if the detected
VERSION matched the requested version passed to find_package. If not
and we are not finding quietly, report problems. If the version check
is satisfied and all REQUIRED_VARS are set, then set each of the
REQUIRED_VARS in the PARENT_SCOPE
PREFIX: The package prefix passed to find_package for this moduleVERSION: The detected tool versionREQUIRED_VARS: Required variables, set in parent scope if present Must specify at least one.
Sometimes you might want to set some variables after running a find macro which indicate the location of data files related to the tool, or even other useful binaries. To do this, it is useful to have the "installation root" of the tool.
Places the full path to SUBDIRECTORY_TO_FIND in PATH_RETURN if found in
INSTALL_ROOT
INSTALL_ROOTThe directory to search forSUBDIRECTORY_TO_FIND: The name of the subdirectory to findPATH_RETURN: A variable to place the full path when found
For the path to a TOOL_EXECUTABLE, get the installation prefix
of that executable and place it in the variable named by INSTALL_ROOT_RETURN
TOOL_EXECUTABLE: Path to an executableINSTALL_ROOT_RETURN: A variable to place the full path to install root- [Optional]
PREFIX_SUBDIRECTORY: A partial path of directories between the executable itself and install root (eg /bin/)
Find macros are supposed to respect PREFIX_FIND_QUIETLY. Having a bunch of
if conditions can be quite tedious to write, so tooling-find-pkg-util provides
a function called psq_print_if_not_quiet which handles this logic for you.
Print a message as specified as part of ARGN as long as
${PREFIX}_FIND_QUIETLY is not set.
PREFIX: The package prefix passed to find_package for this moduleMSG: Message to printDEPENDS: Variables, which when changed, the message should be re-displayed