Commit Graph

67 Commits

Author SHA1 Message Date
Brad King 3a790251f4 Document and test find_package <pkg>_DIR env var
The find_package(<pkg>) command checks the <pkg>_DIR environment
variable.  This commit documents and tests the feature.
2009-11-04 13:14:57 -05:00
Brad King 71910b3fd4 Fix find_package() when <pkg>_DIR is wrong
When <pkg>_DIR is set to an incorrect version we search again and store
the result in the variable, even if it is <pkg>_DIR-NOTFOUND.

There was a bug in the case when the new search does not find anything
and the old value came from a cache entry with UNINITALIZED type.  The
command used to try to load a package configuration file from the last
place searched, and would leave the old wrong value in the entry.  This
commit fixes the behavior to avoid trying to load a missing file and to
set the value to <pkg>_DIR-NOTFOUND as expected.
2009-10-07 14:37:30 -04:00
Brad King 56d1a1780d Create cmMakefile::PlatformIs64Bit helper method
This method centralizes tests for whether CMAKE_SIZEOF_VOID_P is 8.
2009-09-30 13:45:14 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
Brad King 6c59b924d2 Use BeAPI for per-user package registry on Haiku
Applications on Haiku are discouraged from storing their data in $HOME.
This teaches export(PACKAGE) and find_package() to use the BeAPI on
Haiku to store the package registry instead of using ~/.cmake/packages.

See issue #9603.
2009-09-28 09:45:34 -04:00
Brad King b41a548d86 Add parentheses around '&&' between '||' for gcc
The GNU compiler warns about possible operator precedence mistakes and
asks for explicit parentheses (-Wparentheses).  We add the parentheses
to silence the warning.  This also fixes one real logic error in the
find_package() implementation by correcting expression evaluation order.
2009-09-11 08:18:15 -04:00
Brad King ed0650f6ae Teach find_package to search a "package registry"
A common user workflow is to build a series of dependent projects in
order.  Each project locates its dependencies with find_package.  We
introduce a "user package registry" to help find_package locate packages
built in non-standard search locations.

The registry explicitly stores locations of build trees providing
instances of a given package.  There is no defined order among the
locations specified.  These locations should provide package
configuration files (<package>-config.cmake) and package version files
(<package>-config-version.cmake) so that find_package will recognize the
packages and test version numbers.
2009-09-01 14:04:27 -04:00
Brad King be24db77d0 Fix find_package for cmake-gui registry entry
The find_package commands looks at the "WhereBuild" registry entries
created by CMakeSetup and cmake-gui hoping that the project was recently
built.  CMakeSetup created WhereBuild1..WhereBuild10 but cmake-gui
creates WhereBuild0-WhereBuild9.

This fixes find_package to look at WhereBuild0 so that the most recently
configured project can be found.  It is important in the case that the
package to be found was the last one configured in cmake-gui but the
current project that is finding it is configured from the command line.
2009-08-05 09:56:02 -04:00
Alexander Neundorf bc9703b695 STYLE: fix typos in the docs
Alex
2009-04-19 12:48:30 -04:00
Brad King c332e0bf3c ENH: Isolate policy changes in included scripts
Isolation of policy changes inside scripts is important for protecting
the including context.  This teaches include() and find_package() to
imply a cmake_policy(PUSH) and cmake_policy(POP) around the scripts they
load, with a NO_POLICY_SCOPE option to disable the behavior.  This also
creates CMake Policy CMP0011 to provide compatibility.  See issue #8192.
2009-01-22 13:18:40 -05:00
Brad King c980021814 ENH: Refactor find_package version file scoping
This converts the variable and policy scope protection find_package()
uses when loading version files to use automatic variables.
2009-01-22 10:56:58 -05:00
Brad King c1e791ce10 BUG: Fix find_package docs for refind feature
Recently we taught find_package to re-find a package configuration file
if it is given a wrong answer.  This fixes the documentation to reflect
the change.
2009-01-15 16:16:19 -05:00
Alexander Neundorf ef3e48c3d5 ENH: when trying to find a FooConfig.cmake file, if in the directory pointed
to by the Foo_DIR variable there is no FooConfig.cmake file, then instead of
abort and complain that the user should set or clear the Foo_DIR variables,
just search for the file and discard the old Foo_DIR contents

The tests succeed, ok by Brad.

Alex
2009-01-08 17:57:52 -05:00
Brad King 3958b3e112 ENH: Teach find_package about more install dirs
We now search in

  <prefix>/<name>*/
  <prefix>/<name>*/(cmake|CMake)

when looking for package configuration files.  This is useful on Windows
since the Program Files folder is in CMAKE_SYSTEM_PREFIX_PATH.  These
paths are the Windows equivalent to the Apple convention application and
framework paths we already search.  See issue #8264.
2008-12-17 09:24:05 -05:00
Brad King 2d842b6798 BUG: find_package must push/pop policies
When the find_package command loads a <name>-version.cmake file to test
the package version it must prevent the version file from affecting
policy settings.  Therefore the policy settings must be pushed and
popped.
2008-12-16 09:23:41 -05:00
Brad King e51969ac49 ENH: Add useful search locations to find_package
This teaches find_package to search

  <prefix>/(share|lib)/cmake/<name>*/

for package configuration files.  Packages that do not already have
files in a <prefix>/lib/<name>* directory can use this location to avoid
cluttering the lib directory.
2008-12-09 14:07:19 -05:00
Brad King 4f5a8b9c0c STYLE: Remove old TODO comment in find_package
Versioning has been introduced to find_package, so the comment about it
is out of date.
2008-12-09 14:07:10 -05:00
Brad King ae28ec9f24 ENH: Preserve <pkg>_FIND_XXX vars in find_package
When the find_package command loads a module it sets several
<pkg>_FIND_XXX variables to communicate information about the command
invocation to the module.  This restores the original state of the
variables when the command returns.  This behavior is useful when a
find-module recursively calls find_package with NO_MODULE so that the
inner call does not change the values in the find-module.
2008-12-09 10:08:54 -05:00
Brad King 25a5c34a62 ENH: Remove implicit NO_MODULE when recursing
Recently we taught find_package that the NO_MODULE option is implied
when it is recursively invoked in a find-module.  This behavior may be
confusing because two identical calls may enter different modes
depending on context.  It also disallows the possibility that one
find-module defers to another find-module by changing CMAKE_MODULE_PATH
and recursively invoking find_package.  This change reverts the feature.
2008-10-08 10:56:23 -04:00
Brad King 0ae545ebad ENH: Add UNSUITABLE result to package version test
Package version test files may now declare that they are unsuitable for
use with the project testing them.  This is important when the version
being tested does not provide a compatible ABI with the project target
environment.
2008-10-03 10:41:15 -04:00
Brad King 79e9b75558 ENH: Help recursive find_package calls in modules
These changes teach find_package to behave nicely when invoked
recursively inside a find-module for the same package.  The module will
never be recursively loaded again.  Version arguments are automatically
forwarded.
2008-10-03 10:40:07 -04:00
Brad King 75f8d5aab7 ENH: Warn and ignore EXACT without version
If the find_package command is invoked with the EXACT option but without
a version, warn and ignore the option.
2008-10-03 10:39:53 -04:00
Brad King 994262e5cc ENH: Improve find_package version numbering
Make the number of version components specified explicitly available.
Set variables for unspecified version components to "0" instead of
leaving them unset.  This simplifies version number handling for find-
and config-modules.  Also support a fourth "tweak" version component
since some packages use them.
2008-09-10 10:11:48 -04:00
Brad King d8bfafeff8 ENH: Improve message for bad find_package call
Use the new-style error reporting mechanism to provide more context
information for a find_package call with a bad package name.  When the
package is not required, issue a warning instead of an error.
2008-09-08 10:08:33 -04:00
Alexander Neundorf c2cc883430 COMP: fix compile warning/error (non-void function returning void)
Alex
2008-09-07 06:52:06 -04:00
Alexander Neundorf 8903f88b36 ENH: provide the xxx_FIND_QUIETLY, xxx_FIND_REQUIRED and xxx_FIND_VERSION_ variables
also in Config mode, so the xxxConfig.cmake files can e.g. test the QUIETLY
parameter and print something or not

Alex
2008-09-06 19:10:02 -04:00
Brad King 2b96e0edab ENH: Teach find_package about lib64 paths
When find_package is about to look in <prefix>/lib, search first in
<prefix>/lib64 in cases that find_library would use lib64 paths.
2008-08-12 19:01:04 -04:00
Brad King d50785e26e ENH: Make find_* command search order more intuitive.
- The CMAKE_PREFIX_PATH and similar variables have both
    environment and CMake cache versions.
  - Previously the environment value was checked before the
    cache value.
  - Now the cache value is favored because it is more specific.
2008-06-09 15:22:09 -04:00
Brad King 5b406c9044 ENH: Add HINTS option to find_* commands.
- Hints are searched after user locations but before system locations
  - The HINTS option should have paths provided by system introspection
  - The PATHS option should have paths that are hard-coded guesses
2008-06-09 15:08:59 -04:00
Brad King d53e5dec37 ENH: In find_* implementation centralize addition of trailing slashes
- Create cmFindCommon::AddTrailingSlashes
  - Use it in cmFindBase and cmFindPackageCommand
  - Remove duplication from other find commands
2008-06-09 11:57:56 -04:00
Brad King 789c167b6f ENH: Refactor cmFindCommon, cmFindBase, and cmFindPackageCommand
- Add each part of the search order in a separate method.
  - Collect added paths in an ivar in cmFindCommon.
  - Move user path storage up to cmFindCommon and share
    between cmFindBase and cmFindPackageCommand.
  - Expand user path registry values up in cmFindCommon
    - Enables 32-/64-bit registry view for find_package
    - Disables registry expansion for paths not specified
      with the PATHS argument, which is not expected.
2008-06-05 18:20:16 -04:00
Brad King 3406e1ef2c ENH: Added not to find_package documentation about unspecified choice among multiple versions. 2008-01-29 09:57:39 -05:00
Brad King 41c2895b75 ENH: Added version support to Config mode of find_package command.
- Added EXACT option to request an exact version.
  - Enforce version using check provided by package.
  - Updated FindPackageTest to test versioning in config mode.
2008-01-28 20:38:48 -05:00
Ken Martin 0e69d38004 ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class 2008-01-23 10:28:26 -05:00
Brad King 480d733daf ENH: Updated find_package documentation to describe common usage first. 2008-01-21 22:48:07 -05:00
Brad King 9a16d01591 COMP: snprintf is not portable. 2008-01-21 13:04:08 -05:00
Brad King f41b1e8e91 ENH: Implement version support in the find_package command module mode. Version numbers provided to the command are converted to variable settings to tell the FindXXX.cmake module what version is requested. This addresses issue #1645. 2008-01-21 08:48:33 -05:00
Brad King 2eff05e5cb STYLE: Fix line-too-long. 2008-01-18 08:19:37 -05:00
Brad King 119e02631c ENH: Clarify documentation of find_package command. 2008-01-17 20:59:57 -05:00
Brad King 5ef98132dd COMP: Fix warning about missing virtual destructor. 2008-01-17 10:32:27 -05:00
Brad King b424df917d ENH: Major improvements to the FIND_PACKAGE command. See bug #3659.
- Use CMAKE_PREFIX_PATH and CMAKE_SYSTEM_PREFIX_PATH among other means
    to locate package configuration files.
  - Create cmFindCommon as base for cmFindBase and cmFindPackageCommand
  - Move common functionality up to cmFindCommon
  - Improve documentation of FIND_* commands.
  - Fix FIND_* commands to not add framework/app paths in wrong place.
2008-01-17 09:02:31 -05:00
Brad King 994c88559a STYLE: Removed trailing whitespace. 2007-12-15 14:17:21 -05:00
Alexander Neundorf 53d9d84f6b STYLE: improved error message for the case that neither FindFoo.cmake nor
FooConfig.cmake were found

Alex
2007-09-21 11:42:40 -04:00
Alexander Neundorf 9d45638988 ENH: also process "~" and paths relative to CMAKE_CURRENT_SOURCE_DIR in Foo_DIR
Alex
2007-08-20 08:49:21 -04:00
Alexander Neundorf 9deca5887d ENH: remove the watch for the upper case variable name, it breaks the
feature summary, which needs to check for both the upper case and original
case _FOUND variables

Alex
2007-08-08 13:05:27 -04:00
Alexander Neundorf 8d7b502337 ENH: add global properties for collecting enabled/disabled features during
the cmake run and add macros print_enabled/disabled_features() and
set_feature_info(), so projects can get a nice overview at the end of the
cmake run what has been found and what hasn't
FIND_PACKAGE() automatically adds the packages to these global properties,
except when used with QUIET
Maybe this can also be useful for packagers to find out dependencies of
projects.

Alex
2007-08-07 15:41:57 -04:00
Andy Cedilnik f9f1ccadb3 ENH: Add variable watch command 2007-04-11 15:13:05 -04:00
Brad King d9f1d4d71a ENH: Added NO_MODULE and COMPONENTS options to improve flexibility of the command. Re-implemented argument parsing to be simpler and more robust. 2006-10-26 11:39:56 -04:00
Brad King 6f52ed1c8e ENH: Added creation of XXX_FIND_COMPONENTS list of all components requested with REQUIRED option. This addresses the feature request in bug#3494. 2006-07-11 17:10:00 -04:00
Ken Martin 2af4710525 STYLE: fix line length 2006-05-10 15:46:45 -04:00