Commit Graph

79 Commits

Author SHA1 Message Date
Chuck Atkins 9784af1b50 CMP0065: Restrict the use of CMAKE_SHARED_LIBRARY_LINK_<LANG>_FLAGS
This new policy restricts the addition of the shared library link flags
to executables only when the ENABLE_EXPORTS property is set to True.
2015-09-21 10:12:13 -04:00
Matt McCormick 14e49ed156 if: Add "TEST <test>" condition
if(TEST TestNameThatExists) will return true if a test with the name
TestNameThatExists has been added with add_test.  The syntax is similar
to if(TARGET TargetName).  Since use of "TEST" as an argument to if()
could previously be interpreted as a non-keyword argument, add policy
CMP0064 to treat it as a keyword as NEW behavior.
2015-08-03 09:22:25 -04:00
Brad King 482a3bf3f0 Help: Document explicitly that policy OLD behavior is deprecated
The most likely documentation page a project author will read in
response to a policy warning is the page for the policy itself.
Add to every policy documentation page a note explicitly stating
that the OLD behavior is deprecated.  Also mention this in the
cmake_policy() command documentation that explains how to set a
policy to OLD.

Suggested-by: Fraser Hutchison <fraser.hutchison@gmail.com>
2015-06-09 09:29:41 -04:00
Brad King 700f1c3b2b Honor visibility properties for all target types (#15556)
The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN were first
merged in commit v2.8.12~322 (Merge topic 'VISIBILITY_PRESET-property',
2013-06-05) but worked only for shared libraries and executables with
exports.  Prior to commit v3.0.0-rc1~581^2 (GenerateExportHeader:
Deprecate add_compiler_export_flags function., 2013-09-02) the
add_compiler_export_flags function was used to add visibility flags to
all targets.

The visibility flags are useful for sources in all target types because
they may be later linked into shared libraries or executables with
exports.  Introduce policy CMP0063 to enable them for all target types
while preserving compatibility with existing projects that do not expect
this.
2015-05-26 09:03:16 -04:00
Stephen Kelly b85d3b66c6 install: Disallow installing export() result. 2015-05-14 21:38:29 +02:00
Brad King 226df303f9 CTest: Stop telling 'make' to ignore errors with -i
Add policy CMP0061 to maintain compatibility for existing projects.
2015-05-12 09:06:49 -04:00
Brad King 735b7092e8 Merge topic 'if-IN_LIST'
aed6239e if: Implement new IN_LIST operator
2015-04-30 10:32:03 -04:00
Brad King b39929ab42 Merge topic 'revert-CMP0057'
32a2f414 Revert "add_custom_command: Diagnose MAIN_DEPENDENCY limitation."
2015-04-30 10:32:01 -04:00
Nils Gladitz aed6239e40 if: Implement new IN_LIST operator 2015-04-30 10:21:19 -04:00
Nils Gladitz 32a2f41402 Revert "add_custom_command: Diagnose MAIN_DEPENDENCY limitation."
This reverts commit 242c3966 (add_custom_command: Diagnose
MAIN_DEPENDENCY limitation, 2015-03-09) and the follow up commit
b372a99a (UseSWIG: Do not use MAIN_DEPENDENCY on custom commands,
2015-03-26).

I misdiagnosed the underlying issue that prompted creation of policy CMP0057.
The actual issue surfaces when a single custom command's MAIN_DEPENDENCY
is listed in more than one target; this issue will have to be addressed
independently.
2015-04-30 10:20:20 -04:00
Tamás Kenéz 9535b86d3c Help: Replace CMP0054 example to show when it makes a difference
The previous example for CMP0054 did not show how critical the policy is
since the result is the same in both cases (NEW and OLD behavior).
Instead show an example when the policy does make a difference.
2015-04-29 11:25:16 -04:00
Nils Gladitz 853ef717aa Help: Clarify policy CMP0026 title
Clarify that the policy only applies to build targets and
not e.g. imported targets.

Suggested-by: Alan W. Irwin
2015-04-28 10:44:37 +02:00
Brad King 882f48e5ba Link libraries by full path even in implicit directories
When CMP0003 was first introduced we wanted to link all libraries by
full path.  However, some projects had problems on platforms where
find_library would find /usr/lib/libfoo.so when the project really
wanted to link to /usr/lib/<arch>/libfoo.so and had been working by
accident because pre-CMP0003 behavior used -lfoo to link.

We first tried to address that in commit v2.6.0~440 (Teach find_library
to avoid returning library paths in system directories, 2008-01-23) by
returning just "foo" for libraries in implicit link directories.  This
caused problems for projects expecting find_library to always return a
full path.  We ended up using the solution in commit v2.6.0~366 (...
switch library paths found in implicit link directories to use -l,
2008-01-31).  However, the special case for libraries in implicit link
directories has also proven problematic and confusing.

Introduce policy CMP0060 to switch to linking all libraries by full path
even if they are in implicit link directories.  Explain in the policy
documentation the factors that led to the original approach and now to
this approach.
2015-04-09 11:29:18 -04:00
Stephen Kelly 06f61c26cf Do not treat DEFINITIONS as a built-in directory property
Add policy CMP0059 to cover this change.  The property has been
deprecated since CMake 2.4 anyway.

This will help clean up cmMakefile -- the DefineFlagsOrig member should
not need to exist.
2015-04-02 13:00:48 -04:00
Brad King bd9c7f9b2c Ninja: Add policy to require explicit custom command byproducts
Add policy CMP0058 to avoid generating 'phony' ninja rules for unknown
custom command dependencies.  This requires projects to specify their
custom command byproducts explicitly.  With this requirement we no
longer have to assume that unknown custom command dependencies are
generated and can instead simply assume they are source files expected
to exist when the build starts.  This is particularly important in
in-source builds.  It is also helpful for out-of-source builds to allow
Ninja to diagnose missing files before running custom command rules that
depend on them.
2015-03-20 17:40:12 -04:00
Nils Gladitz 242c396656 add_custom_command: Diagnose MAIN_DEPENDENCY limitation.
The new policy CMP0057 diagnoses reuse of the same MAIN_DEPENDENCY across
multiple custom commands.
2015-03-09 12:45:38 +01:00
Brad King ccbdac21df Merge topic 'doc-CMP0054-example'
f2f1c95d Help: Extend policy CMP0054 documentation with an example
2014-12-12 11:15:59 -05:00
Nils Gladitz f2f1c95dd9 Help: Extend policy CMP0054 documentation with an example 2014-12-12 11:12:46 -05:00
Brad King 88eb5824da try_compile: Pass linker flags into test project (#14066)
Copy CMAKE_EXE_LINKER_FLAGS into the test project generated by
try_compile, just like we already copy CMAKE_<LANG>_FLAGS.

Add CMake Policy CMP0056 to activate this behavior in a compatible way,
but do not warn by default when the policy is not set since it will
affect all try_compile calls.

Extend the RunCMake.try_compile test with a case covering this behavior
for each policy setting.
2014-12-03 15:30:22 -05:00
Brad King 8b5591f93e Merge topic 'doc-CMP0053-dedup-char'
191d2b20 Help: Remove duplicate '#' in CMP0053 valid character list
2014-12-01 08:57:30 -05:00
Christoph Grüninger 191d2b209b Help: Remove duplicate '#' in CMP0053 valid character list 2014-12-01 08:32:51 -05:00
Gregor Jasny d54617d006 break: Add policy CMP0055 to check calls strictly
Reject break() without loop scope or any arguments.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-11-25 14:14:20 -05:00
Nils Gladitz 188a1f236e If: Introduce policy CMP0054 - don't dereference quoted variables in if() 2014-09-11 21:23:17 +02:00
Brad King e619964052 Merge topic 'doc-CMP0022-compat-version-typo'
91857e04 CMP0022: Fix version documented to support LINK_PUBLIC/LINK_PRIVATE
2014-08-13 11:10:54 -04:00
Brad King 91857e0423 CMP0022: Fix version documented to support LINK_PUBLIC/LINK_PRIVATE
These have been available since 2.8.7, not 2.8.9 as the docs said.
2014-08-13 10:59:30 -04:00
Peter Kümmel 0c4835a3e8 Help: Add missing space in policy CMP0020 description 2014-05-30 15:20:13 -04:00
Ben Boeckel 25102efc1d EVIS: Add policy CMP0053
This policy switches between the old EVIS parser and the new, faster
parser.
2014-05-08 13:24:49 -04:00
Stephen Kelly 692228e418 Help: Link to cmake-buildsystem from CMP0052 docs. 2014-04-17 11:05:20 +02:00
Stephen Kelly 454b4bd244 Help: Fix typo in CMP0051.
STRIP_GENEX -> GENEX_STRIP.
2014-04-14 23:00:30 +02:00
Stephen Kelly 783bce295b Export: Disallow exported interface includes in src/build tree (#14592).
Allow directories in the source tree or build tree only if the
install tree is a subdirectory of the source tree or build tree,
as appropriate.

Re-use the test files in the RunCMake.include_directories test
to run in multiple scenarios.  Bump the required CMake version
in the test to 3.0 to ensure that the new policy warnings are
emitted correctly.
2014-04-09 10:38:49 +02:00
Brad King 93054aa84f Merge topic 'target-sources-refactor'
5de63265 Genex: Only evaluate TARGET_OBJECTS to determine target sources.
aa0a3562 cmGeneratorTarget: Compute target objects on demand
042c1c83 cmTarget: Compute languages from object libraries on demand.
fdcefe3c cmGeneratorTarget: Compute consumed object libraries on demand.
c355d108 cmComputeTargetDepends: Track object library depends.
e5da9e51 cmTarget: Allow any generator expression in SOURCES property.
5702e106 cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
857d30b5 cmGlobalGenerator: Add interface to call ForceLinkerLanguages
28e1d2f8 cmStringCommand: Add GENEX_STRIP subcommand.
bf98cc25 Genex: Evaluate TARGET_OBJECTS as a normal expression.
8cd113ad cmTarget: Store strings instead of cmSourceFile* to represent SOURCES.
4959f341 cmSourceFileLocation: Collapse full path for directory comparisons.
fcc92878 cmSourceFileLocation: Remove unused Update method.
59e8740a cmTarget: Remove AddSourceFile method
26d494ba cmTarget: Use string API to add sources to cmTarget objects.
d38423ec cmTarget: Add a method to obtain list of filenames for sources.
...
2014-04-03 12:51:51 -04:00
Stephen Kelly 5702e10677 cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
Add policy CMP0051 to control this behavior.
2014-04-02 23:12:56 +02:00
Brad King a41c0a9dcb Do not warn by default when policy CMP0025 or CMP0047 is not set
These policies are triggered by the use of a particular compiler rather
than outdated CMake code in a project.  Avoid warning in every project
that enables a language by not displaying the policy warning by default.
Add variable CMAKE_POLICY_WARNING_CMP<NNNN> to control the warning
explicitly; otherwise enable the warning with --debug-output or --trace.

This breaks with strict policy convention because it does not provide
developers with any warning about the behavior change by default.
Existing projects will continue to build without a warning or change in
behavior.  When a developer changes the minimum required version of
CMake in a project to a sufficiently high value (3.0), the project will
suddenly get the new compiler id and may break, but at least the
breakage comes with a change to the project rather than the version of
CMake used to build it.

Breaking strict policy convention is worthwhile in this case because
very few projects will be affected by the behavior change but every
project would have to see the warning if it were enabled by default.
2014-04-02 14:43:54 -04:00
Brad King d339653eaf Help: Revise and format policy CMP0025 and CMP0047 docs
Add inline reST markup as appropriate.  Word CMP0047 docs more like
those of CMP0025.  State explicitly that the policies must be set
before the project or enable_language command calls.
2014-04-02 14:42:45 -04:00
Stephen Kelly c903b5319b cmTarget: Restore <CONFIG>_LOCATION to CMP0026 OLD behavior (#14808)
Restore support for the undocumented <CONFIG>_LOCATION target property
removed by commit v3.0.0-rc1~175^2 (cmTarget: Remove support for
<CONFIG>_LOCATION property, 2013-12-30) as part of the CMP0026 OLD
behavior.
2014-03-17 09:30:39 -04:00
Stephen Kelly 38df26bc6f CMP0043: Document old and new interfaces for setting directory property. 2014-03-03 10:11:19 -05:00
Stephen Kelly f2eee72fac add_custom_command: Disallow use of SOURCE signatures.
Add CMP0050 to control this behavior.
2014-02-12 11:19:27 -05:00
Stephen Kelly c248a437c4 Add policy CMP0049 to avoid variable expansion in source lists 2014-02-12 11:17:38 -05:00
Brad King 5d05124cb7 Merge topic 'doc-policy-version-3.0'
aab11bca Help: Change version 3.0.0 -> 3.0 in policy docs
2014-02-10 15:40:33 -05:00
Brad King aab11bcab4 Help: Change version 3.0.0 -> 3.0 in policy docs
Starting with 3.0 we will use only two components for the feature level,
and policies are only ever introduced with a bump to the feature level
version.
2014-02-10 11:40:21 -05:00
Stephen Kelly f02b5fb5a0 Help: Fix typo.
'to not to' -> 'not to'
2014-02-07 14:25:19 +01:00
Brad King 7e142c5ac2 project: Manage VERSION variables
Teach the project() command to set variables

  {PROJECT,<PROJECT-NAME>}_VERSION{,_MAJOR,_MINOR,_PATCH,_TWEAK}

holding the project version number and its components.  Add project()
command option "VERSION" to specify the version explicitly, and default
to the empty string when it is not given.

Since this clears variables when no VERSION is given, this may change
behavior for existing projects that set the version variables themselves
prior to calling project().  Add policy CMP0048 for compatibility.

Suggested-by: Alex Neundorf <neundorf@kde.org>
2014-01-29 09:45:18 -05:00
Stephen Kelly e00db59d6c QNX: Introduce QCC compiler id for that QNX platform compiler.
Introduce policy CMP0047 to control resetting the id for
compatibility.

De-duplicate content in the QNX platform file by including the GNU
one. QNX is a form of GNU platform.

Do not clear CMAKE_SHARED_LIBRARY_${lang}_FLAGS variables.  They
are populated again later by the Compiler/GNU.cmake file anyway.

Modify the CMAKE_CXX_COMPILE_OBJECT variable only when the QCC
compiler id is in use, and the language is CXX.  Use the QNX
recommended flag for QCC instead of the gcc compatible -x flag.

Populate new module files to handle system includes and depfiles
when using the QCC compiler.

Remove code which unsets the system include and depfiles related
variables.  When a GNU driver is used instead of the QCC one, the
appropriate flags will be used.  These variables were previously
cleared for lowest-common-denominator compatibility with both
drivers.
2014-01-22 08:47:32 -05:00
Nils Gladitz 0bf6f13b1d AddDependencies: new policy requires dependencies to exist
Added new policy CMP0046 which requires dependencies added by
add_dependencies() to actually exist.
2014-01-12 12:58:04 +01:00
Brad King 15562c11ef Merge topic 'policies'
73e9340 get_target_property: Error on non-existent target.
ab9f58f FindQt4: Ensure target exists before calling get_target_property.
37ebeb9 FindQt4: Fix use of get_target_property to use actual target name.
6aabb6a Genex: Use case-sensitive comparison for COMPILER_ID.
5bb53f6 cmTarget: Deprecate COMPILE_DEFINITIONS_ properties with a policy.
2014-01-09 09:37:20 -05:00
Stephen Kelly 73e93400e2 get_target_property: Error on non-existent target.
Introduce policy CMP0045 to control this behavior.
2014-01-08 16:41:34 +01:00
Stephen Kelly 6aabb6a62b Genex: Use case-sensitive comparison for COMPILER_ID. 2014-01-08 16:41:34 +01:00
Stephen Kelly 5bb53f6b73 cmTarget: Deprecate COMPILE_DEFINITIONS_ properties with a policy. 2014-01-08 16:41:34 +01:00
Stephen Kelly 28ffb7e0be Note how to write CMP0022 compatible code with CMake 2.8.9.
This has come up on the mailing list, and various other places.
2014-01-08 13:41:24 +01:00
Brad King 0d63bdd2d9 Merge topic 'rpath-default'
d25ad48 OS X: Add CMP0042 to enable MACOSX_RPATH by default
2014-01-02 14:23:09 -05:00