Commit Graph

131 Commits

Author SHA1 Message Date
Daniele E. Domenichelli be8ae96098 Allow the Package Registry to be disabled (#14849)
When a project is packaged for redistribution the local package
registries should not be updated or consulted.  They are for developers.

Add variables to disable use of package registries globally:

* CMAKE_EXPORT_NO_PACKAGE_REGISTRY that disables the export(PACKAGE)
  command
* CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY that disables the User Package
  Registry in all the find_package calls.
* CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY that disables the
  System Package Registry in all the find_package calls.

Update documentation and unit tests.
2014-05-12 09:50:01 -04:00
Stephen Kelly af8a1643c1 Remove c_str calls when using stream APIs.
Use an ad-hoc clang tool for matching the calls which should be
ported.
2014-03-11 15:03:50 +01:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Ben Boeckel 3742bb0d32 stringapi: Use strings for variable names
Variable names are always generated by CMake and should never be NULL.
2014-03-08 13:05:28 -05:00
Stephen Kelly a6971f6510 FeatureSummary: Don't list transitive package dependencies
Set a global property in the find_package implementation.  Track and
reset that property in the find_dependency macro.  Read the property
in FeatureSummary when determining whether to print output.

This means that packages which are found only as dependencies are not
listed by FeatureSummary, but if a project uses find_package elsewhere
directly, then it will be listed by FeatureSummary.

Suggested-by: Alex Merry

 http://thread.gmane.org/gmane.comp.kde.devel.frameworks/10640
2014-02-03 20:20:42 +01:00
Brad King 855e8759fd Merge topic 'minor-cleanups'
3917d86 Genex: Add a nullary form for CONFIG
5169130 Help: Document the target properties exported to IMPORTED targets.
ee21f1c CompatibleInterface: Test debugging of not-set property.
80e9fe9 Help: Note that language-specific 'built-ins' are set by the project command.
0b5bf8a Help: Mention CMAKE_DISABLE_FIND_PACKAGE_<PackageName> in package docs.
28c865b Tests: simplify Qt4 target usage
6cfe6b8 Help: Fix typo: 'target' -> 'target property'
b7deca4 Test: Remove obsolete commented code.
9c9f69f Genex: Make EQUAL support upper case binary literals
6eb3218 Genex: Fix case of methods in the dag checker.
646c6ec Genex: Use a preprocessor loop to implement transitive DAG check.
711fb38 Genex: List transitive properties and methods as a table, not two lists.
802a28f Add cmHasLiteralSuffix API.
2014-01-07 09:39:22 -05:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Stephen Kelly 802a28fc5e Add cmHasLiteralSuffix API. 2014-01-06 18:46:44 +01:00
Clinton Stimpson 0b9906c2fb Windows: Use wide-character system APIs
Make CMake compile with -DUNICODE.  Make it possible for the 8 bit
encoding to eventually be UTF-8 instead ANSI.
2013-12-09 10:29:43 -05:00
Brad King 7d47c69365 Drop compatibility with CMake < 2.4
Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to
a value lower than 2.4, and generate an error when projects or the user
attempt to do so.  In the error suggest using a CMake 2.8.x release.

Teach cmake_minimum_required to warn about projects that do not require
at least CMake 2.4.  They are not supported by CMake >= 3.0.

Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a
reference to policy CMP0001.
2013-10-23 08:54:31 -04:00
Brad King e33d8d2d77 Drop builtin command documentation
Drop all GetTerseDocumentation and GetFullDocumentation methods from
commands.  The command documentation is now in Help/command/*.rst files.
2013-10-16 09:22:36 -04:00
Adrien Destugues 1dc61f8142 Haiku: Remove use of B_COMMON_DIRECTORY
The common directory was removed in Haiku. Applications are now
installed in the system directory.

Applied-by: Rolf Eike Beer <eike@sf-mail.de>
2013-10-08 09:55:38 -04:00
Stephen Kelly b73e05d7c9 Mention that IMPORTED targets may be created by a find_package call. 2013-03-06 21:35:20 +01:00
Stephen Kelly 79ae968a18 Revert "Add a way to exclude INTERFACE properties from exported targets."
This reverts commit 2c3654c3de.

The removal of some tests added in commit 77cecb77 (Add includes and compile
definitions with target_link_libraries., 2012-11-05) are also squashed
into this commit.
2013-02-13 15:12:31 +01:00
Stephen Kelly 71bf96ec78 Revert "find_package: Reword <package>_NO_INTERFACES documentation"
This reverts commit 179f495602.
2013-02-13 15:12:31 +01:00
Brad King 179f495602 find_package: Reword <package>_NO_INTERFACES documentation 2013-02-01 10:30:57 -05:00
Stephen Kelly 2c3654c3de Add a way to exclude INTERFACE properties from exported targets.
Projects set interface requirements upstream, and existing
downstreams use of target_link_libraries will consume those interfaces.

This can create a backward compatibility concern as the result may
be changing the order of include directories of downstreams, or another
side-effect of using the INTERFACE properties.

Provide a way for them to emulate the behavior of a version-based
policy in the config file.
2013-01-31 17:29:04 +01:00
Alex Neundorf 6f50a04cc1 exports: define a CMAKE_FIND_PACKAGE_NAME var set by find_package()
This way the name of the searched package can be accessed in find-modules,
config-files and more importantly in generated target export files.
This is now used when a target export file detects that a required
target does not exist.

Alex
2012-09-30 10:26:54 -04:00
Alex Neundorf ae4ab62569 find_package: add support for a <package>_NOT_FOUND_MESSAGE variable
If a config-file sets <package>_FOUND to FALSE, it can now give a reason
using the variable <package>_NOT_FOUND_MESSAGE, which is used by cmFindPackage
and FPHSA.

Alex
2012-09-28 09:21:36 -04:00
Alex Neundorf 1f8f58a0b9 fix #13195: avoid multiple mentions of found packages
Now before adding a package to the list of found or not-found
packages, the package is remvoed from both lists before.

Alex
2012-05-06 16:32:10 +02:00
Brad King 5ed93db4cf find_package: Fix components signature documentation (#13142)
Update the signature notation to show that "REQUIRED COMPONENTS ..." is
allowed and that REQUIRED is an option on its own.
2012-04-19 09:41:17 -04:00
Brad King 6c12e820b8 find_package: Document <package>_FIND_* variables (#13142)
When loading a find module or package config file the find_package
command defines several variables to provide information about the
caller's request.  Previously this was documented only in the
Modules/readme.txt file which is not distributed.  Document the
behavior explicitly in the main find_package documentation.
2012-04-18 09:17:35 -04:00
Alex Neundorf 34108cd3b3 find_package: add documentation for OPTIONAL_COMPONENTS
This patch adds documentation for OPTIONAL_COMPONENTS to cmFindPackage.cxx,
and also extends Modules/readme.txt significantly with regard to how
components should be handled.

Alex
2012-03-19 10:53:36 -04:00
Alex Neundorf f2e0a18761 find_package: add OPTIONAL_COMPONENTS keyword
Add an OPTIONAL_COMPONENTS keyword to find_package() so we can have a
clear distinction between required and optional components.  Don't allow
a component to be both required and optional.

Alex
2012-03-19 10:53:36 -04:00
Alex Neundorf 16c0c7376c find_package: allow <pkg>Config.cmake to set <pkg>_FOUND to FALSE
Before, find_package in Config mode always set Foo_FOUND to true if the
Config file has been found and could be executed.
If the Config file itself detected some problem, like a missing dependency,
it did not have a way to signal to the outside that the package is not working.
With this patch, if a Config file sets Foo_FOUND to FALSE, this is taken into
account and not overridden.

Alex
2012-03-13 16:56:23 -04:00
David Cole fa0f065426 Merge topic 'find_package_fatal_error_if_required_and_config_not_found'
c5ae733 find_package: Test that REQUIRED aborts processing correctly
c91a54d find_package: error out if REQUIRED Config has not been found
2012-03-08 15:14:23 -05:00
David Cole da43d8fa8d Merge topic 'MakingConfigFilesEasier_ConfigureMacro'
6973e2d wrap write_basic_config_version_file as write_basic_package_version_file()
204f5d4 add CMakePackageConfigHelpers: configure_package_config_file()
2012-03-08 15:14:12 -05:00
Alex Neundorf 6973e2d5a8 wrap write_basic_config_version_file as write_basic_package_version_file()
So the name fits better with configure_package_config_file(), as
discussed on the mailing list. Adapt the documentation accordingly.

Alex
2012-03-07 11:23:18 -05:00
Alex Neundorf c91a54db37 find_package: error out if REQUIRED Config has not been found
If in Config mode a configuration file could not be found, cmake printed
an error, but did not actually stop processing. With SetFatalErrorOccured
it does.

Alex
2012-03-06 21:16:24 +01:00
David Cole e4382180fc Merge topic 'add-const-qualifiers'
737c49a Add 'const' qualifier to some cmCommand members
261491f cmPropertyDefinition::IsChained is const
2012-03-02 11:50:07 -05:00
Yury G. Kudryashov 737c49a357 Add 'const' qualifier to some cmCommand members
Use const_cast for the special case in cmFindBase where
GetFullDocumentation calls GenerateDocumentation.
2012-02-29 13:27:04 -05:00
Brad King d3651041e9 find_package: Optionally warn when implicitly using Config mode
Define variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE for use by a project
that wants to use an explicit mode in every call to find_package in
order to generate more specific failure messages.  Word the warning
using the new CONFIG and MODULE mode keywords when the minimum required
version of CMake is new enough to have them.  Otherwise word the warning
using the old NO_MODULE mode keyword.

Inspired-by: Alex Neundorf <neundorf@kde.org>
2012-02-28 10:01:44 -05:00
Brad King 31ead5f695 find_package: Reject mixed use of MODULE- and CONFIG-only options
Many options imply exclusive Config mode.  The new MODULE option
implies exclusive Module mode.  Do not allow mixed combinations.
2012-02-28 09:58:31 -05:00
Alex Neundorf 6d8308314a find_package: mention requested version number in error message
When neither a Find-module or a config file can be found print the
required version so the user knows which version of the package to
install.
2012-02-28 09:58:31 -05:00
Alex Neundorf 9c39bbd474 find_package: add CONFIG mode keyword alias for NO_MODULE 2012-02-28 09:58:31 -05:00
Alex Neundorf f310f67291 find_package: add MODULE mode to use only Find-modules
The new mode differ from default mode in that that it doesn't fallback
to config mode.  The default mode stays unchanged.
2012-02-28 09:58:01 -05:00
Alex Neundorf 7d67dcf52b find_package: improve error message when no Find module is present
Explain exactly why CMake is looking for a package configuration file
and who is expected to provide what:

 CMake Error at CMakeLists.txt:7 (find_package):
  By not providing "Find<pkg>.cmake" in CMAKE_MODULE_PATH the caller
  has asked CMake to find a package configuration file provided by
  "<pkg>", but CMake did not find one.

  Could not find a package configuration file provided by "<pkg>"
  with any of the names:

    <pkg>Config.cmake
    <pkg>-config.cmake

  Add the installation prefix of "<pkg>" to CMAKE_PREFIX_PATH or
  set "<pkg>_DIR" to a directory containing one of the above files.
  If "<pkg>" provides separate development package or SDK be sure
  it has been installed.

The first paragraph explains how CMake is interpreting the intention of
the caller.  This puts the blame or credit at the call site in the
project code where it belongs both when it is a bug and when it is
intentional.  It can be dropped in NO_MODULE mode.

Suggested-by: Brad King <brad.king@kitware.com>
2012-02-28 09:56:49 -05:00
Alex Neundorf 978d89b99d find_package: rename NoModule to UseFindModules
...positive logic is easier to handle

Alex
2012-02-27 16:36:29 -05:00
Alex Neundorf b3f9fe42f9 find_package: print error if an invalid CONFIGS name is used
In commit 41c2895b (Added version support to Config mode of find_package
command, 2008-01-28) the error message was computed but was not
reported.  Add the SetError call to report it.
2012-02-27 16:09:34 -05:00
Alex Neundorf e6c5b9452a fix FeatureSummary for REQUIRED packages, they were reported as OPTIONAL
Alex
2012-02-11 18:04:26 +01:00
Brad King b0cd630521 Refactor find_* command final path list computation
All find_* commands re-root the list of paths and then add trailing
slashes.  Factor this pair of calls out into a dedicated method.  The
new method would be the only caller to AddTrailingSlashes, so subsume
that method into it.
2011-09-23 14:36:27 -04:00
David Cole 674be27a7f Merge topic 'WriteConfigVersionFile_2TemplateFiles'
c9761de Improve documentation for WriteBasicConfigVersionFile.cmake
208bb90 Set UNSUITABLE instead of not COMPATIBLE
bb03c2d Really fix copyright notice
d50a61a Fix copyright notice
4ba09bc Add some tests for write_basic_config_version_file()
02b1e4b Add example to documentation
d216a67 Provide macro write_basic_config_version_file()
2011-08-16 17:03:00 -04:00
David Cole 2c7b38afa6 Merge topic 'FeatureSummaryImprovements'
b62349c FeatureSummary.cmake: update documentation
f366cf8 FeatureSummary.cmake: cosmetics
f407bb5 FeatureSummary.cmake: only higher TYPEs can override previous TYPEs
02d47ab FeatureSummary.cmake: error out when a REQUIRED package is missing
91a1527 FeatureSummary.cmake: add INCLUDE_QUIET_PACKAGES keyword
0671a02 FeatureSummary.cmake: remove "comment" field
aae13f4 Extend FeatureSummary: add PURPOSE of package and TYPE
2011-08-02 15:09:41 -04:00
Alex Neundorf d216a67e4a Provide macro write_basic_config_version_file()
This macro can be used to generate basic version files which can be
installed along a Config.cmake file to provide versioning support.

This (3rd try) is implemented using a macro, which maps
the COMPATIBILITY mode to a filename and configure_file()s the
resulting file.

Alex
2011-08-01 22:59:18 +02:00
Alex Neundorf 91a1527735 FeatureSummary.cmake: add INCLUDE_QUIET_PACKAGES keyword
Now found packages are not stored in ENABLED/DISABLED_FEATURES
anymore, but always in PACKAGES_FOUND/NOT_FOUND.
ENABLED/DISABLED_FEATURES is now only used via
ADD_FEATURE_INFO(), e.g. for stuff set via option().

Alex
2011-07-17 17:48:00 +02:00
Alex Neundorf a66df08543 Add documentation for the CMAKE_DISABLE_FIND_PACKAGE_<Name> switch
Alex
2011-06-23 11:09:41 +02:00
Alex Neundorf 6e1d3edb4d Add a switch to disable a find_package() call completely
As discussed, this adds a switch CMAKE_DISABLE_FIND_PACKAGE_<name>,
which, when set to TRUE, keeps the find_package() command from executing.
When the package is REQUIRED at the same time, an error is generated.

Alex
2011-06-21 21:18:23 +02:00
Brad King b41ad3b399 Teach find_(library|package) about Linux multiarch (#12037)
Implement support for multiarch as specified here:

  http://wiki.debian.org/Multiarch
  https://wiki.ubuntu.com/MultiarchSpec

Detect the <arch> part of <prefix>/lib/<arch> from the implicit library
search path from each compiler to set CMAKE_<lang>_LIBRARY_ARCHITECTURE.
Define CMAKE_LIBRARY_ARCHITECTURE using one of these values (they should
all be the same).  Teach the find_library and find_package commands to
search <prefix>/lib/<arch> whenever they would search <prefix>/lib.
2011-06-08 10:04:44 -04:00
Brad King b95f3cac91 find_package: Check both 32-bit and 64-bit registry views
The system package registry is under HKEY_LOCAL_MACHINE\SOFTWARE which
has separate views for 32-bit and 64-bit applications.  Look in both
views, but prefer the architecture matching the build target platform.
2011-04-13 13:17:42 -04:00