Commit Graph

10339 Commits

Author SHA1 Message Date
Brad King
e141c9dc15 Merge topic 'ExternalProject-no-extract-bool'
2c4bb705e8 ExternalProject: allow `DOWNLOAD_NO_EXTRACT OFF`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4562
2020-04-03 06:58:22 -04:00
Brad King
35d9ca268b Merge topic 'FindPython-fix-VIRTUALENV-eq-FIRST'
81beb28752 FindPython: fix handling when FIND_VIRTUALENV == FIRST

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4557
2020-04-02 11:12:54 -04:00
Ben Boeckel
2c4bb705e8 ExternalProject: allow DOWNLOAD_NO_EXTRACT OFF
Fixes: #20531
2020-04-02 08:55:04 -04:00
Brad King
f9be12707f Merge topic 'relax_compiler_prefix_detection'
c5dd2ca538 DetermineCompiler: Relax _CMAKE_TOOLCHAIN_PREFIX detection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4547
2020-04-01 10:53:46 -04:00
Brad King
85f87c9d40 Merge topic 'xl-cxx14'
46d9006efa XL: Add comment clarifying why we pretend it has full C++11/14 support
4aaa9ea96c XL: C++14 language level flags are only available on Linux

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4551
2020-04-01 10:42:19 -04:00
Marc Chevrier
81beb28752 FindPython: fix handling when FIND_VIRTUALENV == FIRST
Fixes: #20525
2020-04-01 10:36:46 -04:00
Brad King
46d9006efa XL: Add comment clarifying why we pretend it has full C++11/14 support
Since commit b0f46c48f6 (CompileFeatures: Now able to presume full
language level support, 2019-03-06, v3.15.0-rc1~265^2~1) we pretend that
the XL compiler has full C++11 and C++14 support so that projects
specifying granular features will at least get the corresponding
compiler mode.  This is a work around for our lack of a full feature
check table for this compiler that works in common cases.  Add a comment
explaining this.

Issue: #20521
2020-03-31 10:35:56 -04:00
Brad King
4aaa9ea96c XL: C++14 language level flags are only available on Linux
Since commit 458ea9d76c (XL: Add C++14 language level flags, 2019-04-15,
v3.15.0-rc1~226^2) we use `-qlanglvl=extended1y` for C++14 with XL 16.1.
However, that flag is only supported on a Linux host.

Issue: #20521
2020-03-31 10:35:56 -04:00
Brad King
0f66cb6b22 Merge topic 'FindBoost-lib-prefix-override'
ff71612d02 FindBoost: Allow Boost_LIB_PREFIX to be set externally

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4531
2020-03-31 09:23:13 -04:00
Robert Maynard
c5dd2ca538 DetermineCompiler: Relax _CMAKE_TOOLCHAIN_PREFIX detection
Now detect _CMAKE_TOOLCHAIN_PREFIX whenever a compilers
name matches the heuristics, instead of only doing it
when cross compiling
2020-03-30 17:08:01 -04:00
Brad King
615950dfb6 Merge topic 'cuda_support_bin_util_overrides'
79b6e928c3 CUDA: Support compiler specific FindBinUtils overrides

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Axel Huebl <axel.huebl@plasma.ninja>
Merge-request: !4539
2020-03-30 13:29:36 -04:00
Brad King
cfa3a2342f Merge topic 'gtest_discover_tests_cross_compile_support'
3b4838b57f GoogleTest: Add tests for MultiConfig discovery in PRE_TEST mode
1ba4cb565e GoogleTest: Parameterize tests to check PRE_TEST/POST_BUILD discovery mode
75e82a13db GoogleTest: Add new DISCOVERY_MODE option to gtest_discover_tests
889a7146ff GoogleTestAddTests: Refactor into callable method

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4078
2020-03-30 13:26:49 -04:00
Brad King
e20146b429 Merge topic 'FindBoost-lib-prefix-clarify'
040f503d83 FindBoost: Clarify logic selecting Boost_LIB_PREFIX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4537
2020-03-30 13:24:38 -04:00
Brad King
0188df97e8 Merge topic 'llvm_rc_pp'
4bef0e6450 llvm-rc: Enable preprocessing if CMAKE_RC_COMPILER_INIT is an absolute path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4535
2020-03-30 13:22:02 -04:00
Marc Chevrier
dd0664415a FindPython: use 'sysconfig' as alternate to 'distutils.sysconfig'
To support any python installation, if package 'distutils.sysconfig'
is not available, try to use package 'sysconfig'.

Fixes: #20502
2020-03-28 10:51:47 +01:00
Robert Maynard
79b6e928c3 CUDA: Support compiler specific FindBinUtils overrides 2020-03-27 12:58:01 -04:00
Bartlomiej Cieszkowski
ff71612d02 FindBoost: Allow Boost_LIB_PREFIX to be set externally
On platforms where our default Boost static library prefix is incorrect,
make it possible for users to set it explicitly to work around the problem
until FindBoost can be updated.

Fixes: #20372
2020-03-27 09:48:22 -04:00
Brad King
040f503d83 FindBoost: Clarify logic selecting Boost_LIB_PREFIX
Also add a comment explaining its purpose.
2020-03-27 09:32:47 -04:00
Lucas Wang
4bef0e6450 llvm-rc: Enable preprocessing if CMAKE_RC_COMPILER_INIT is an absolute path
`CMAKE_RC_COMPILER_INIT` and `CMAKE_RC_COMPILER` can be set by user,
for example `llvm-rc-10` and `D:\LLVM\bin\llvm-rc.exe`.
2020-03-27 08:54:58 -04:00
Brad King
f670435715 Merge topic 'pch-warn-invalid'
2ce08e5489 PCH: add an option to disable `-Winvalid-pch`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4499
2020-03-27 08:03:30 -04:00
Brad King
112cb248ae Merge topic 'vs-clangcl'
f3d7a15010 VS: Fix ClangCL toolset compiler path detection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4523
2020-03-27 07:45:15 -04:00
Brad King
83f5ba06df Merge topic 'FindPython-variable-spelling-error'
63580668a8 FindPython: fix variable spelling error

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4529
2020-03-27 07:44:12 -04:00
Brad King
9df587168a Merge topic 'CheckIPOSupported-cleanup-cache'
4b8297721f CheckIPOSupported: Avoid polluting cache with common name 'result'

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !4528
2020-03-27 07:43:03 -04:00
Brad King
184dd23d2e Merge topic 'nmc-cl-showincludes'
6c7e6b1e49 Ninja Multi-Config: Fix MSVC showincludes prefix detection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !4526
2020-03-27 07:41:58 -04:00
Brad King
032df7ae7b Merge topic 'llvm-rc-depfile' into release-3.17
2c724c3aea llvm-rc: Write depfile to location specified by the generator
4cc876540e llvm-rc: Select preprocessor from active languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4524
2020-03-27 07:38:22 -04:00
Brad King
ab96bbff2c Merge topic 'llvm-rc-depfile'
2c724c3aea llvm-rc: Write depfile to location specified by the generator
4cc876540e llvm-rc: Select preprocessor from active languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4524
2020-03-27 07:38:22 -04:00
Marc Chevrier
63580668a8 FindPython: fix variable spelling error 2020-03-26 18:08:25 +01:00
Brad King
4b8297721f CheckIPOSupported: Avoid polluting cache with common name 'result'
Fixes: #20508
2020-03-26 12:57:07 -04:00
Cristian Adam
2ce08e5489 PCH: add an option to disable -Winvalid-pch
Fixes: #20295
2020-03-26 14:24:46 +01:00
Brad King
6257d43ffd Merge topic 'compile-commands-collapse-whitespace'
e565053bce Ninja: Remove unnecessary newlines in compile commands
5d4bab500e Avoid consecutive whitespace in rules
d8622fbd0f Modules: Collapse consecutive whitespace in strings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4512
2020-03-26 09:13:45 -04:00
Brad King
545875bebe Merge topic 'mingw-windres-cross-compile'
af4adf6aa9 MinGW: Fix default windres selection when cross-compiling
0251ddadab MinGW: Drop unnecessary windres selection code with Unix Makefiles

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4520
2020-03-26 09:06:13 -04:00
Brad King
6c7e6b1e49 Ninja Multi-Config: Fix MSVC showincludes prefix detection
Activate the detection logic for this generator too.

Fixes: #20506
2020-03-26 08:47:36 -04:00
Brad King
f3d7a15010 VS: Fix ClangCL toolset compiler path detection
Prior to commit 3c125c6de0 (VS: Support Visual Studio Clang Toolkit
identification, 2019-12-03, v3.17.0-rc1~341^2) using `-T ClangCL`
would work but `CMAKE_{C,CXX}_COMPILER` would be detected as `cl.exe`
even though `clang-cl.exe` is the actual compiler.  That commit
attempted to fix the detection by using `$(ClangClExecutable)`
as we do for LLVM-distributed toolsets, but that is not actually
defined.  Instead, look for `$(CLToolExe)` in the `PATH`.

Fixes: #20504
2020-03-26 08:18:25 -04:00
Thomas Bernard
2c724c3aea llvm-rc: Write depfile to location specified by the generator
Move the depfile flags to `CMAKE_DEPFILE_FLAGS_RC` so that they
are only usedwith generators that use depfiles.  Also switch to
using the `<DEPFILE>` placeholder for the location of the depfile
so that it goes where the generator expects.

Fixes: #20493
2020-03-26 07:26:21 -04:00
Thomas Bernard
4cc876540e llvm-rc: Select preprocessor from active languages
The llvm-rc preprocessor is selected according to the
CMAKE_C_COMPILER_ID / CMAKE_CXX_COMPILER_ID which are only defined when
the C or CXX language is active.
2020-03-26 07:25:33 -04:00
Brad King
79415fa6d3 Merge topic 'FindRuby-rvm'
905d5667e8 FindRuby: Add support for RVM installations
e6699b9b59 FindRuby: Validate Ruby_EXECUTABLE before accepting it

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4386
2020-03-25 08:16:38 -04:00
Brad King
f2b4576373 Merge topic 'FindPython-polish'
bf1ecfef7f FindPython: misc. fixes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4519
2020-03-25 08:13:07 -04:00
Brad King
af4adf6aa9 MinGW: Fix default windres selection when cross-compiling
When cross-compiling to MinGW, select the `windres` tool named with the
toolchain's prefix.

Fixes: #20500
2020-03-25 07:21:01 -04:00
Brad King
0251ddadab MinGW: Drop unnecessary windres selection code with Unix Makefiles
Since commit 957c2aac7f (RC: Simplify selection of resource compiler
based on C/C++ toolchain, 2015-05-07, v3.3.0-rc1~93^2~5) we select
windres as the RC compiler on MinGW via `CMAKE_RC_COMPILER_INIT`.  Drop
the special case from commit be9afbf453 (Find mingw's windres also when
Unix Makefiles are used, 2012-08-27, v2.8.10~152^2).
2020-03-25 07:21:01 -04:00
Marc Chevrier
bf1ecfef7f FindPython: misc. fixes
Help: Fix errors regardings HINTS.
Code: Optimize Python signature cache variable to avoid unecessary searchs.
2020-03-24 18:26:16 +01:00
Daan De Meyer
d8622fbd0f Modules: Collapse consecutive whitespace in strings 2020-03-23 21:34:17 +01:00
Julien Marrec
905d5667e8 FindRuby: Add support for RVM installations 2020-03-23 13:22:23 +01:00
Julien Marrec
e6699b9b59 FindRuby: Validate Ruby_EXECUTABLE before accepting it 2020-03-23 13:21:40 +01:00
Ryan Thornton
75e82a13db GoogleTest: Add new DISCOVERY_MODE option to gtest_discover_tests
Introducing a new DISCOVERY_MODE mode option, which provides greater control
over when gtest_discover_tests perforsm test discovery.

It has two supported modes:
* POST_BUILD
* PRE_TEST

POST_BUILD is the default behavior, which adds a POST_BUILD command
to perform test discovery after the test has been built.

PRE_TEST is a new mode, which delays test discovery until test execution.

DISCOVERY_MODE can be controlled in two ways:
1. Setting the DISCOVERY_MODE when calling gtest_discover_tests
2. Setting the global CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE
   prior to calling gtest_discover_tests

By delaying test discovery until ctest runtime,
we can provide better cross compile support,
because we're more likely to be in an environment that can run the test executable.

This was achieved by moving the command for test discovery
into the generated ctest include file.

In PRE_TEST mode, the generated include file now has the form:

if(EXISTS "path/to/test.exe")
  if("path/to/test.exe" IS_NEWER_THAN "path/to/ctest_file")
    // command to discover tests
    // and generate ctest_file
  endif()
  include("path/to/ctest_file")
endif()
elseif()
  // test not built
endif()

Which generates the appropriate CTest files at runtime
and regenerates the CTest files when the executable is updated.

In the old approach, test discovery was always added as POST_BUILD step
and the executable was ran in order to scan for tests.

If the test executable failed to run for any reason,
this resulted in a link failure.

This failure could more commonly occur when cross compiling,
because your build environment might not have
the appropriate runtime environment dlls required to run the test executable.

I also ran into the issue when compiling a Qt application using Qt Creator.
Qt Creator manages its build and runtime environments separately
and only adds the Qt dlls to the environment during runtime -- not during build.

So when gtest_discover_tests ran my test executable,
it promptly crashed because the environment wasn't correct,
which resulted in a build failure.

Setting the DISCOVERY_MODE to PRE_TEST fixed my build failure
by delaying test discovery until runtime,
because this allowed the test exe to run in the proper environment.

A few non-trivial implementation details worth noting:

1. bracket_arguments

In the PRE_TEST side, parameters whose contents might contain special characters,
need to be handled with great care.

To aid in escaping these list arguments, backslashes, and other special characters,
and ensuring that they are preserved in the generated file,
bracket arguments (i.e. [== <...> ==]) are used.

For example:

    gtest_discover_tests(
      ...
      EXTRA_ARGS how now "\"brown\" cow"
    )

Generates a file with the following call:

    gtest_discover_tests_impl(
      ...
      TEST_EXTRA_ARGS [==[how;now;"brown" cow]==]
    )

This way the arguments are forwarded correctly.

2. multi-config generators

Multi-Config generators (e.g. MSBuild) now work more correctly in
PRE_TEST than POST_BUILD.

PRE_TEST is more correct because it will generate a unique CTest file for each configuration.

It generates a per config file responsible for test discovery:
    foo[1]_include-Debug.cmake
    foo[1]_include-MinSizeRel.cmake
    foo[1]_include-Release.cmake
    foo[1]_include-RelWithDebInfo.cmake

A per config file for containing the google tests:
    foo[1]_tests-Debug.cmake

And an outer ctest file:
    foo[1]_include-Debug.cmake

That is generically written to include the correct configuration file
by looking at the value of ${CTEST_CONFIGURATION_TYPE} when CTest runs.

POST_BUILD, in contrast, preserves the existing functionality.

Tests are disocvered based on the last configuration that was chosen
and only a single file is produced:
    foo[1]_include.cmake
    foo[1]_tests.cmake

But it runs with whatever executable requested by ctest --config,
which means it's possible to run the wrong tests
if some tests were enabled in one configuration but not another.
2020-03-20 10:14:39 -05:00
Brad King
dfca1887b0 Merge topic 'FindMatlab-r2020' into release-3.17
75331a4578 FindMatlab: Add R2020a=9.8

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4507
2020-03-20 06:22:48 -04:00
Brad King
a2bbc34ace Merge topic 'FindMatlab-r2020'
75331a4578 FindMatlab: Add R2020a=9.8

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4507
2020-03-20 06:22:48 -04:00
Brad King
3ab89b5475 Merge topic 'GetPrerequisites-vcruntime-is-system' into release-3.17
417b765f5a GetPrerequisites: Classify vcruntime libraries as system

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4506
2020-03-20 06:17:49 -04:00
Brad King
7c0346e90a Merge topic 'GetPrerequisites-vcruntime-is-system'
417b765f5a GetPrerequisites: Classify vcruntime libraries as system

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4506
2020-03-20 06:17:49 -04:00
Ryan Thornton
889a7146ff GoogleTestAddTests: Refactor into callable method
Move test discovery logic into new gtest_discover_tests_impl method
and make GoogleTestAddTests aware of whether it is being launched in
CMake's script mode.

When launched in script mode, gtest_discover_tests_impl is called
passing arguments obtained from the definitions passed into the call to cmake.
(i.e. cmake -P GoogleTestAddTests -D <arg1> -D <arg2> ...)

This preserves the existing behavior assumed by GoogleTest.cmake.
Unit tests are unchanged and still pass.

Looking ahead, it also allows GoogleTestAddTests to be included in generated files
and call gtest_discover_tests_impl to perform test discovery at test runtime
with the new PRE_TEST discovery mode introduced later in this branch.

My original approach attempted to call execute_process(cmake -P ...) in
the generated file, the same way POST_BUILD is doing, but I ran into
difficulties serializing the command arguments correctly.

By exposing a way to call gtest_discover_tests_impl directly from our generated file,
we remove a layer of shell quoting / parsing that our arguments have to survive,
which simplifies the act of producing a generated file that behaves the
same as its POST_BUILD counterpart.
2020-03-19 11:59:20 -05:00
Michael Hirsch, Ph.D
75331a4578 FindMatlab: Add R2020a=9.8
This allows Matlab R2020a to be recognized as a valid Matlab version.
2020-03-19 12:47:10 -04:00