Commit Graph

1481 Commits

Author SHA1 Message Date
Brad King
1882ba2e05 Merge topic 'extend-compile-language-genex'
2ae880fa Genex: Enable COMPILE_LANGUAGE for COMPILE_OPTIONS with Visual Studio
2b7d59f3 Genex: Enable COMPILE_LANGUAGE for file(GENERATE) with Visual Studio
0f6f7c8a Genex: Fix COMPILE_LANGUAGE messages to allow file(GENERATE) with Xcode
c5a82d0f Tests: Decouple COMPILE_LANGUAGE in file(GENERATE) from COMPILE_OPTIONS
25773650 Tests: Remove unnecessary result files from RunCMake.File_Generate

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Jason Juang <jasjuang@gmail.com>
Merge-request: !1511
2017-11-27 09:00:44 -05:00
Brad King
baa19f658f Merge topic 'gtest-fix-discovery'
70f9f62d GoogleTest: Fix multiple discovery on same target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1510
2017-11-21 13:00:24 -05:00
Matthew Woehlke
70f9f62da8 GoogleTest: Fix multiple discovery on same target
According to the documentation, tests can be discovered for a target
multiple times by using a different prefix and/or suffix to ensure name
uniqueness. However, while this worked for gtest_add_tests, it did not
work with gtest_discover_tests because the generated file that sets up
the tests was named based only on the target name, and so subsequent
discovery from the same target would clobber earlier discovery.

Fix this by introducing a counter that records how many times discovery
has been used on a target, and use this to generate unique names of the
generated test list files.
2017-11-21 12:05:34 -05:00
Brad King
2ae880fa8f Genex: Enable COMPILE_LANGUAGE for COMPILE_OPTIONS with Visual Studio
Since commit v3.9.0-rc4~3^2~1 (VS: Fix target_compile_options for CUDA,
2017-06-21), the evaluation of `COMPILE_LANGUAGE` receives the proper
language.  The set of compile flags used for a target's C and C++
sources is based on the linker language.  By default this is always the
C++ flags if any C++ sources appear in the target, and otherwise the C
flags.  Therefore we can define the `COMPILE_LANGUAGE` generator
expression in `COMPILE_OPTIONS` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
can do.  It is also sufficient for many use cases since the set of
allowed flags for C and C++ is almost the same in Visual Studio.
Furthermore, since the VS generator moves many of the flags to
declarative `.vcxproj` elements, it will automatically avoid passing
C++ flags for C sources.

Issue: #17435
2017-11-20 13:51:25 -05:00
Brad King
66b37132b6 Merge topic 'cpack-minor-cleanup-and-tests-extension'
325f34d1 CPack tests: add possibility for expecting config developer warnings
176281e1 CPack test: correctly handle CPACK_PACKAGING_INSTALL_PREFIX
cf0c2599 CPack: set variable commands in lower case
2ff906b3 CPack: documentation typo fix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1499
2017-11-20 10:09:14 -05:00
Brad King
9100ea1d82 Merge topic 'FindOpenGL-glvnd-policy'
2ea17412 FindOpenGL: Add policy CMP0072 to prefer GLVND for legacy GL

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Clinton Stimpson <clinton@elemtech.com>
Merge-request: !1491
2017-11-20 09:43:27 -05:00
Domen Vrankar
325f34d150 CPack tests: add possibility for expecting config developer warnings 2017-11-19 14:55:00 +01:00
Domen Vrankar
176281e131 CPack test: correctly handle CPACK_PACKAGING_INSTALL_PREFIX
Every CPack generator sets default CPACK_PACKAGING_INSTALL_PREFIX
variable value differently so test framework should support
that correctly - previous version expected RPM/Deb /usr default and
removed it for Archive packagers as the default there is /.
2017-11-19 14:55:00 +01:00
Brad King
2b7d59f310 Genex: Enable COMPILE_LANGUAGE for file(GENERATE) with Visual Studio
Issue: #17435
2017-11-17 14:31:07 -05:00
Brad King
0f6f7c8ab1 Genex: Fix COMPILE_LANGUAGE messages to allow file(GENERATE) with Xcode
When rejecting the `COMPILE_LANGUAGE` generator expression on include
directories and compile definitions with Xcode, add `file(GENERATE)` to
the allowed set in the message.  It is allowed and already covered
by the `RunCMake.File_Generate` test `COMPILE_LANGUAGE-genex` case.
2017-11-17 11:56:00 -05:00
Brad King
c5a82d0f88 Tests: Decouple COMPILE_LANGUAGE in file(GENERATE) from COMPILE_OPTIONS
Simplify the `RunCMake.File_Generate` test `COMPILE_LANGUAGE-genex`
case to avoid requiring support for the genex in `COMPILE_OPTIONS`.
2017-11-17 11:55:58 -05:00
Brad King
2577365040 Tests: Remove unnecessary result files from RunCMake.File_Generate
The default result is "0" anyway.
2017-11-17 11:40:14 -05:00
Brad King
2ea17412a9 FindOpenGL: Add policy CMP0072 to prefer GLVND for legacy GL
Fixes: #17449
2017-11-17 07:17:28 -05:00
Brad King
fb114a40aa Tests: Add test for bad foreach inside a function
Add test for a case fixed by commit 6a4a61d9e1 (cmForEachCommand:
prevent leakage, 2017-10-09).  Prior to that fix, this test case
could trigger an assertion failure.

Fixes: #17464
2017-11-16 11:10:05 -05:00
Brad King
163be8714a Merge topic 'update-ctest-documentation'
3b272ff8 Help: Add 'Label and Subproject Summary' section to ctest(1) manual
002d0a1c Help: Normalize capitalization of 'CTest' in ctest(1) manual
9d3aa95c Help: Divide ctest(1) manual options into sections
7904b659 Tests: Remove incorrect use of 'test-timeout' option
e80dc2ad cmCTest: Remove dead code

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1427
2017-11-10 08:05:45 -05:00
Betsy McPhail
7904b659ea Tests: Remove incorrect use of 'test-timeout' option 2017-11-10 07:52:05 -05:00
Domen Vrankar
7e896029cd CPack: enable setting default dir creation permissions
Introduces CPACK_DEFAULT_DIRECTORY_INSTALL_PERMISSIONS
variable which adds support for functionality introduced
by CMAKE_DEFAULT_DIRECTORY_INSTALL_PERMISSIONS variable.

Fixes #17333

# Conflicts:
#	Help/release/dev/cmake-default-dir-install-permissions.rst
2017-11-08 20:27:11 +01:00
Domen Vrankar
a4c829167d CPack test: expand output checking fallback
Some tests can have the same output for a certain
subtest no matter which packaging generator is used.
2017-11-08 20:27:11 +01:00
Brad King
30fcf13be6 Merge topic 'imported-promotion'
6a3922be Add new target-property `IMPORTED_GLOBAL`.
854e482a cmTarget: Simplified and fixed a string-comparision.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1254
2017-11-08 09:08:15 -05:00
Deniz Bahadir
6a3922bebe Add new target-property IMPORTED_GLOBAL.
The purpose of this new `IMPORTED_GLOBAL` target-property is to prolong
the lifetime and scope of `IMPORTED` targets in such a way as if they
had been created with the keyword `GLOBAL` in the first place.

* It can only be set to `TRUE`. That means, a local `IMPORTED` target
  can be promoted to global scope but a global `IMPORTED` target cannot
  be degraded to local scope!
* Setting it to `TRUE` only succeeds if done from within the same
  directory in which the `IMPORTED` target was created in the first
  place.

Fixes #17256.
2017-11-07 15:08:41 +01:00
luzpaz
777e87ae00 Fix trivial typos in text
Some are user facing.

Found using

    codespell -q 3 --skip="./Utilities" -I .cmake-whitelist.txt`

whereby the whitelist contained:

    ans
    dum
    helpfull
    emmited
    emmitted
    buil
    iff
    isnt
    nto
    ot
    pathes
    substract
    te
    todays
    upto
    whitespaces
2017-11-03 10:25:05 -04:00
Brad King
a0ec14d363 Add deprecation warnings for policies CMP0054 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for some policies
to encourage projects to port away from setting policies to OLD.
2017-11-01 11:46:53 -04:00
Brad King
cdc9c110a5 Merge topic '16780-write-single-xcodeproj'
e4e9ce7c Xcode: Add option to generate only topmost project file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1395
2017-11-01 08:02:15 -04:00
Gregor Jasny
e4e9ce7cbe Xcode: Add option to generate only topmost project file
Closes #16780
2017-10-31 17:09:26 +01:00
Brad King
6341596e29 Merge topic 'cmp0037-conditional-targets'
ae5f4069 CMP0037: Allow test and package targets when features are not enabled
409527a0 CMP0037: De-duplicate check and message generation
a2611d81 Tests: Add RunCMake.CMP0037 case for WARN on reserved targets
103501c4 Tests: Do not enable languages in all cases of RunCMake.CMP0037
2d0b3e6e cmGlobalGenerator: Refactor test and package target conditions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !1417
2017-10-31 08:19:27 -04:00
Brad King
ae5f40696e CMP0037: Allow test and package targets when features are not enabled
When CMake will not generate a test, package, or package_source target,
allow projects to create their own targets with these names.

Fixes: #16062
2017-10-30 10:21:31 -04:00
Brad King
58e0692b62 Merge topic 'cpack-deb-0-so-version-support'
5784ab8f CPack/Deb: handle shlibs file generation when SOVERSION set to 0

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1423
2017-10-30 08:55:36 -04:00
Brad King
e48397ee29 Merge topic 'cpack-rpm-dist-test-fix'
9ce00cae CPack/RPM: DIST-MONOLITHIC-type subtest fix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1424
2017-10-30 08:52:48 -04:00
Brad King
da00080ed4 Merge branch 'cpack-rpm-dist-test-fix' into release-3.10
Merge-request: !1424
2017-10-30 08:50:21 -04:00
Domen Vrankar
9ce00caee3 CPack/RPM: DIST-MONOLITHIC-type subtest fix
Test was failing in case dist macro contained
a + symbol which is valid but must be escaped
for using the string as a regex.

Fixes #17328
2017-10-30 08:48:46 -04:00
Brad King
a7b770686a Merge topic 'fix-co-compile'
197b4e18 Merge branch 'backport-fix-co-compile' into fix-co-compile
992962c7 cmcmd: Restore support for running multiple lint tools
a5197eea cmcmd: Convert lint handlers to file-static functions
1c075ffd cmcmd: Rename loop iteration variable for clarity

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1418
2017-10-30 08:46:59 -04:00
Domen Vrankar
5784ab8fca CPack/Deb: handle shlibs file generation when SOVERSION set to 0
Setting CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS did not
auto generate shlibs control file when .so version
of the library was set to 0.

Fixes #17318
2017-10-29 00:20:54 +02:00
Brad King
8ffc1c3d89 Merge topic 'generalize-importedtargets-behavior'
fb88d2b5 Help: Add notes for topic 'generalize-importedtargets-behavior'
494906a8 Add support for IMPORTED GLOBAL targets to be aliased
fe4b25ec Teach target_* commands to set INTERFACE properties of IMPORTED targets
e40fd9fd cmTargetPropCommandBase: Fix typo in error message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Henry Schreiner <henryschreineriii@gmail.com>
Merge-request: !1264
2017-10-27 09:47:31 -04:00
Brad King
b779b8e85f Merge topic 'cmp0040-wording'
a1b1f1a2 CMP0040: Clarify policy warning to match documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1415
2017-10-27 09:42:37 -04:00
Brad King
0504fc8d84 Merge branch 'backport-fix-co-compile' into release-3.10
Merge-request: !1418
2017-10-27 09:41:25 -04:00
Brad King
197b4e18d4 Merge branch 'backport-fix-co-compile' into fix-co-compile
Resolve a logical conflict by replacing `cmArray{Begin,End}` from
the their side with `cm::{cbegin,cend}` from our side.
2017-10-27 09:31:04 -04:00
Brad King
992962c76d cmcmd: Restore support for running multiple lint tools
Refactoring in commit v3.10.0-rc1~115^2 (Clean up iwyu code to not be
one big if statement, 2017-08-28) incorrectly changed the logic to run
only one lint tool at a time.  Restore support for running all tools
specified on the command-line.
2017-10-27 09:26:50 -04:00
Brad King
a2611d816b Tests: Add RunCMake.CMP0037 case for WARN on reserved targets 2017-10-26 14:11:19 -04:00
Brad King
103501c4e0 Tests: Do not enable languages in all cases of RunCMake.CMP0037 2017-10-26 14:11:19 -04:00
Brad King
f01576012f Merge branch 'cmp0040-wording' into release-3.10
Merge-request: !1415
2017-10-26 09:48:28 -04:00
Brad King
a1b1f1a282 CMP0040: Clarify policy warning to match documentation
In commit v3.5.0-rc1~8^2~2 (Help: Clarify policy `CMP0040`
documentation, 2016-01-28) the documentation was clarified to indicate
that the target must be defined in the current directory.  Do the same
for the text of the policy warning itself.

Fixes: #17399
2017-10-26 09:47:29 -04:00
Deniz Bahadir
494906a8a2 Add support for IMPORTED GLOBAL targets to be aliased
Issue: #15569
Issue: #17197
2017-10-26 09:11:04 -04:00
Deniz Bahadir
fe4b25ec2f Teach target_* commands to set INTERFACE properties of IMPORTED targets
Now, several `INTERFACE_*` properties can be set on `IMPORTED` targets,
not only via `set_property` and `set_target_properties` but also via
`target_compile_definitions`, `target_compile_features`,
`target_compile_options`, `target_include_directories`, `target_sources`
and `target_link_libraries`.

Fixes: #15689
Issue: #17197
2017-10-26 09:11:04 -04:00
Deniz Bahadir
e40fd9fd19 cmTargetPropCommandBase: Fix typo in error message 2017-10-26 09:11:00 -04:00
Brad King
b5dd256d94 Merge topic 'defer-target-source-check'
4e7f6738 Defer check for sources within a target until generation.
6e4e7c65 Tests: Exclude bad RunCMake.add_executable case on multi-arch Xcode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1242
2017-10-25 08:11:19 -04:00
Deniz Bahadir
4e7f67383f Defer check for sources within a target until generation.
The `add_library` and `add_executable` commands can now be called with
no source-files and won't generate a warning or error message, as long
as source-files will be added later via the `target_sources` command.
If during the generation step still no sources are associated with
targets created by such calls a useful error message will be generated
and generation fails.

Targets of type `INTERFACE_LIBRARY`, `UTILITY` or `GLOBAL_TARGET` are
excluded from this check because we do not need sources for these target
types during generation.

Fixes: #16872
2017-10-24 08:14:47 -04:00
Brad King
6e4e7c6547 Tests: Exclude bad RunCMake.add_executable case on multi-arch Xcode
The `NoSourcesButLinkObjects` case would not be expected to work under
Xcode with multiple architectures even if the target objects were listed
directly as sources.  Exclude it.  We already exclude similar cases in
`RunCMake.add_library`.
2017-10-24 08:11:29 -04:00
Brad King
9ffb35386f VS: Select and save a VS 2017 instance persistently
Visual Studio 2017 supports multiple instances installed on a single
machine.  We use the Visual Studio Installer tool to enumerate instances
and select one.  Once we select an instance for a given build tree, save
the result in `CMAKE_GENERATOR_INSTANCE` so we can re-configure the tree
with the same instance on future re-runs of CMake.

Fixes: #17268
2017-10-19 10:20:12 -04:00
Brad King
314613d1af Add infrastructure for generators to select a build tool instance
Add cache entry `CMAKE_GENERATOR_INSTANCE` to hold the instance location
persistently across re-runs of CMake in a given build tree.

For now we reject the option by default if explicitly set.  It will be
implemented on a per-generator basis.  Pass the setting into try_compile
project generation.  Add a RunCMake.GeneratorInstance test to cover
basic use cases for the option.  Verify that `CMAKE_GENERATOR_INSTANCE`
is empty by default, and that it is rejected when the generator does not
support a user setting.

Issue: #17268
2017-10-19 10:20:08 -04:00
Brad King
358ceee5d8 Merge topic 'curl_netrc_options'
d45aa38a Add dev notes for topic 'curl_netrc_options'
60c272b6 ExternalProject: Add support for NETRC and NETRC_FILE suboption
754e39dd Add testcases for file(DOWNLOAD|UPLOAD) netrc options
5d67e902 file(DOWNLOAD|UPLOAD): Add 'NETRC' and 'NETRC_FILE' suboption

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ruslan Baratov <ruslan_baratov@yahoo.com>
Merge-request: !1376
2017-10-19 09:27:43 -04:00