Commit Graph

20087 Commits

Author SHA1 Message Date
Brad King 229a5bc903 Merge branch 'fix-cmake_parse_arguments-expansion' into release 2016-02-12 11:25:36 -05:00
Dimitar Yordanov c8c45a2c4e cmake_parse_arguments: Restore ;-list argument flattening
The re-implementation in commit v3.5.0-rc1~116^2~1 (CMakeParseArguments:
replace by native cmake_parse_arguments command, 2015-12-05) introduced
a regression when parsing the ARGN arguments with cmake_parse_arguments.
The original implementation used

    foreach(currentArg ${ARGN})

to iterate over input arguments.  This flattened ;-lists within the
arguments whether they were quoted or not.  Fix our new implementation
to preserve this behavior and add a test case to cover it.

Signed-off-by: Dimitar Yordanov <dimitar.yordanov@sap.com>
Signed-off-by: Matthias Maennich <matthias.maennich@sap.com>
2016-02-12 11:19:40 -05:00
Brad King 2410a20ebb Merge branch 'cmake-gui-reset-generator' into release 2016-02-12 10:22:31 -05:00
Brad King da490e1159 cmake-gui: Fix cmState initialization when changing generators (#15959)
Refactoring in commit v3.3.0-rc1~29^2~1 (cmState: Host some state from
the cmGlobalGenerator, 2015-05-24) moved storage of some generator
traits over to cmState.  However, it accidentally removed initialization
of the values from the cmGlobalGenerator constructor.  This is needed
because generator subclasses update the settings in their constructors.
Since a single cmState instance is shared across multiple build trees by
cmake-gui, initializing the values in its constructor is not enough.
Fix this by restoring the needed initializations to the
cmGlobalGenerator constructor.
2016-02-12 10:21:00 -05:00
Brad King 8d1b37a2b2 CMake 3.5.0-rc2 2016-02-10 09:23:57 -05:00
Brad King b162dd9ea0 Merge branch 'curl-pre-7.21.5' into release 2016-02-09 13:26:50 -05:00
Brad King 1ea55acf8a cmCurl: Fix compilation with system curl versions prior to 7.21.5
This version introduced CURLE_NOT_BUILT_IN which we have used since
commit v3.4.0-rc1~211^2~4 (cmCurl: Tolerate lack of CURLOPT_CAPATH
support, 2015-08-12).  For older versions, just define the name to the
then-unused error code so that we can compile.
2016-02-09 13:24:19 -05:00
Brad King 0570b4e4ea Merge branch 'fix-target-lookup-performance-regression' into release 2016-02-08 13:23:45 -05:00
Brad King 9b7d5871b8 Improve internal generator target structure lookup
In commit v3.5.0-rc1~272^2~6 (cmGlobalGenerator: Add FindGeneratorTarget
API, 2015-10-25) a lookup was implemented via linear search.  Replace it
with an efficient data structure.

Suggested-by: Stephen Kelly <steveire@gmail.com>
2016-02-08 13:08:11 -05:00
Brad King 6cbf6a5197 Fix internal target lookup performance regression
Refactoring in commit v3.5.0-rc1~272^2~13 (cmGlobalGenerator: Remove
direct storage of targets, 2015-10-25) replaced an efficient data
structure mapping from target name to cmTarget instance with a linear
search.  Lookups through cmGlobalGenerator::FindTarget are done a lot.
Restore the efficient mapping structure with a name indicating its
purpose.

Reported-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2016-02-08 13:08:11 -05:00
Brad King 656bf0da2c Merge branch 'fix-install-EXPORT-crash' into release 2016-02-08 10:46:42 -05:00
Brad King cb409699a4 Merge branch 'fix-Fortran-module-in-subdir' into release 2016-02-08 10:35:30 -05:00
Brad King 47460f3e15 install(EXPORT): Fix crash on target in another directory
Refactoring merged by commit v3.5.0-rc1~299 (Merge topic
'use-generator-target', 2015-10-20) in and around
commit v3.5.0-rc1~299^2~13 (cmExportSet: Store a cmGeneratorTarget,
2015-10-17) changed export sets to delay looking up actual targets and
stores only their names.  However, in InstallCommand::HandleExportMode
we need to lookup targets immediately to check them for
EXPORT_LINK_INTERFACE_LIBRARIES.  The check was accidentally made local
to the current directory, so if an export set contains a target from
another directory the lookup fails and CMake crashes.  Fix the check to
look up the target name globally, and tolerate when no target is found
just in case.

Reported-by: Kelly Thompson <kgt@lanl.gov>
2016-02-05 09:45:16 -05:00
Brad King c5eb21b6d1 Fix dependency scanning configuration in subdirectories
Refactoring in commit v3.5.0-rc1~347^2~2 (Set the current dirs on the
snapshot before creating the cmMakefile) accidentally changed the
source and binary directories configured in `cmake -E cmake_depends`
for use during dependency scanning.  This can cause the wrong directory
information to be loaded.  It also breaks Fortran module dependency
scanning for modules provided by targets in subdirectories that do
not have Fortran_MODULE_DIRECTORY set.

Fix the dependency scanning directory configuration and add a test to
cover the Fortran module case in which the breakage was observed.

Reported-by: Kelly Thompson <kgt@lanl.gov>
2016-02-05 09:26:44 -05:00
Brad King 8a8d22cf1e CMake 3.5.0-rc1 version update 2016-02-02 08:37:05 -05:00
Brad King 570e84b44b Merge topic 'remove-stray-semicolon'
ccb2d5c0 cmAlgorithms.h: remove superfluous semicolon after method
2016-02-02 08:33:23 -05:00
Brad King f8e5e5bb03 Merge topic 'fix-CMAKE_MATCH-self-match'
6ffc4323 cmConditionEvaluator: Fix matching of `CMAKE_MATCH_*` values (#15944)
2016-02-02 08:33:20 -05:00
Kitware Robot 6a230df636 CMake Nightly Date Stamp 2016-02-02 00:01:05 -05:00
Christoph Grüninger ccb2d5c07f cmAlgorithms.h: remove superfluous semicolon after method 2016-02-01 10:47:25 -05:00
Brad King c022b6f686 Merge topic 'clarify-add_custom_command-TARGET-scope'
d257d681 add_custom_command: Clarify error when TARGET is out of scope (#15681)
4d53e0a7 Help: Clarify `add_custom_command(TARGET)` scope (#15681)
8c615af4 Help: Clarify policy `CMP0040` documentation (#15681)
63c5808f Help: Clarify scope of `if(TARGET)` expression
a336e438 Help: Improve markup in `if` command documentation
88968265 Help: Improve markup in `get_target_property` documentation
2016-02-01 10:43:51 -05:00
Brad King 6ffc432367 cmConditionEvaluator: Fix matching of `CMAKE_MATCH_*` values (#15944)
While evaluating `if(MATCHES)` we get a `const char*` pointer to the
string to be matched.  On code like

    if(CMAKE_MATCH_COUNT MATCHES "Y")

the string to be matched may be owned by our own result variables.
We must move the value to our own buffer before clearing them.
Otherwise we risk reading freed storage.
2016-02-01 10:05:10 -05:00
Kitware Robot e18d0df5ed CMake Nightly Date Stamp 2016-02-01 00:01:03 -05:00
Kitware Robot 13b4ef24e1 CMake Nightly Date Stamp 2016-01-31 00:01:03 -05:00
Kitware Robot f270404a3d CMake Nightly Date Stamp 2016-01-30 00:01:03 -05:00
Kitware Robot 76a51dfab8 CMake Nightly Date Stamp 2016-01-29 00:01:04 -05:00
Brad King d257d68138 add_custom_command: Clarify error when TARGET is out of scope (#15681)
The add_custom_command(TARGET) signature only works for targets defined
in the current directory.  Clarify this in the error message when the
target exists but was defined elsewhere.

Inspired-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2016-01-28 10:33:26 -05:00
Kitware Robot 5335d27552 CMake Nightly Date Stamp 2016-01-28 00:01:04 -05:00
Kitware Robot 30e294f68f CMake Nightly Date Stamp 2016-01-27 00:01:03 -05:00
Kitware Robot e7eab0ec40 CMake Nightly Date Stamp 2016-01-26 00:01:13 -05:00
Brad King 0586f1798e Merge topic 'vs-win10-sdk'
d7e863c1 VS: Do not fail on Windows 10 with VS 2015 if no SDK is available (#15929)
2016-01-25 09:47:11 -05:00
Kitware Robot b9dadca90b CMake Nightly Date Stamp 2016-01-25 00:01:03 -05:00
Kitware Robot 490483b947 CMake Nightly Date Stamp 2016-01-24 00:01:03 -05:00
Kitware Robot 4a3fa1e8a0 CMake Nightly Date Stamp 2016-01-23 00:01:04 -05:00
Brad King dcf977ea1a Merge topic 'fix-use-generator-target'
7dbfdddf cmExportInstallFileGenerator: Fix crash in FindNamespaces
2016-01-22 09:25:30 -05:00
Kitware Robot f81ccc5753 CMake Nightly Date Stamp 2016-01-22 00:01:03 -05:00
Brad King 3e7794a2e6 Merge topic 'reduce-allocations'
70788e92 Remove temporary allocations when calling cmHasLiteral{Suf,Pre}fix.
bd2384f5 Optimize cmMakefile::ExpandVariablesInStringNew.
ad9394f4 Remove temporary allocations in cmMacroHelper::InvokeInitialPass.
f9599ed4 Remove temporary allocations by extending the lifetime of the retval.
275f2a85 Remove temporary allocations when calling cmGeneratorTarget::GetName.
2016-01-21 13:55:53 -05:00
Brad King 563a6c7be0 Merge topic 'cmake-E-time-quoting'
1787269e cmake: Fix `-E time` argument passing to child
2016-01-21 13:55:47 -05:00
Brad King d7e863c1c1 VS: Do not fail on Windows 10 with VS 2015 if no SDK is available (#15929)
Since commit v3.4.0-rc1~5^2~1 (VS: Add support for selecting the Windows
10 SDK, 2015-09-30) the VS 2015 generator requires a Windows 10 SDK to
be available when CMAKE_SYSTEM_VERSION specifies Windows 10 (e.g.  when
building on a Windows 10 host).  Howewver, it is possible to install VS
2015 without any Windows 10 SDK.  Instead of failing with an error
message about the lack of a Windows 10 SDK, simply tolerate this case
and use the default Windows 8.1 SDK.  Since building for Windows Store
still requires the SDK, retain the diagnostic in that case.
2016-01-21 11:50:28 -05:00
Andrey Pokrovskiy 7dbfdddf33 cmExportInstallFileGenerator: Fix crash in FindNamespaces
Refactoring merged by commit 9afbb733ec (Merge topic
'use-generator-target', 2015-10-20) in and around commit 381e7afd
(cmExportSet: Store a cmGeneratorTarget, 2015-10-17) forgot to update
one place in this method.  This leads to a crash in code such as

  add_library(A a.c)
  add_library(B b.c)
  target_link_libraries(B A)
  install(TARGETS B DESTINATION lib EXPORT ExpB)
  install(EXPORT ExpB DESTINATION lib/cmake/test)
  add_executable(C c.c)
  install(TARGETS C DESTINATION bin EXPORT ExpC)

Fix the target name reference to avoid using an unpopulated Target
pointer.
2016-01-21 10:53:30 -05:00
Kitware Robot 750ae8d5a8 CMake Nightly Date Stamp 2016-01-21 00:01:04 -05:00
Milian Wolff 70788e9264 Remove temporary allocations when calling cmHasLiteral{Suf,Pre}fix.
When the first argument passed is a std::string, we need to take it
by const&, otherwise we copy the string and trigger a temporary
allocation. This patch removes a few 10k temporary allocations when
running the CMake daemon on the KDevelop build dir.

This hotspot was found with heaptrack.
2016-01-20 21:20:55 +01:00
Milian Wolff bd2384f593 Optimize cmMakefile::ExpandVariablesInStringNew.
We can remove the temporary allocations required for the
default-constructed t_lookup passed into the openstack by refactoring
the code slightly. Furthermore, we use a vector instead of a stack,
since the latter is based on a deque which is not required for a
heap / lifo structure.

This patch removes ~215k allocations.

This hotspot was found with heaptrack.
2016-01-20 21:20:55 +01:00
Milian Wolff ad9394f4fd Remove temporary allocations in cmMacroHelper::InvokeInitialPass.
This code used to convert std::string's to raw C strings only to
put that back into a std::string. This patch thus removes ~70k
temporary allocations when running the CMake daemon on KDevelop.

This hotspot was found with heaptrack.
2016-01-20 21:20:55 +01:00
Milian Wolff f9599ed42f Remove temporary allocations by extending the lifetime of the retval.
See also Herb Sutter's article on the "most important const":
http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/

When running the CMake daemon on the KDevelop build dir, this removes
some hundreds of thousands of temporary allocations.

This hotspot was found with heaptrack.
2016-01-20 21:20:55 +01:00
Milian Wolff 275f2a85b2 Remove temporary allocations when calling cmGeneratorTarget::GetName.
This happens quite often from within comparisons such as in
NamedGeneratorTargetFinder or FindGeneratorTargetImpl. It is the
top hotspot of both, number of allocations as well as number of
temporary allocations - the majority of calls lead to temporary
allocations.

In raw numbers, this patch removes ~1E6 temporary allocations of
1.5E6 temporary allocations in total when running the cmake daemon
on the KDevelop build dir. That is 2/3 of the total.

This hotspot was found with heaptrack.
2016-01-20 21:20:54 +01:00
Brad King 1787269ef3 cmake: Fix `-E time` argument passing to child
Since this command was introduced in 2002 it has incorrectly constructed
the child process command line by concatenating arguments separated by
spaces with no quoting.  Fix this by passing the command argument vector
directly to RunSingleCommand without an intermediate quoting and
re-parsing step.

Reported-by: Andrey Pokrovskiy <wonder.mice@gmail.com>
2016-01-20 08:55:23 -05:00
Brad King d8bced813c Merge topic 'cleanup-RunSingleCommand'
1040e690 cmSystemTools: Teach RunSingleCommand to merge child pipes when possible
ce3b713b cmSystemTools: Simplify RunSingleCommand output string construction
dc039cc0 cmSystemTools: Drop redundant condition in RunSingleCommand
ffa2a8c9 cmSystemTools: Rename OUTPUT_NORMAL to OUTPUT_FORWARD to clarify its purpose
92e9bb21 cmcmd.cxx: Remove unused code in __run_iwyu implementation
fb1526f5 cmake: Change `-E chdir` to pass through stdout/stderr directly
2016-01-20 08:33:41 -05:00
Brad King ae5f30b36a Merge topic 'mfc-utility-targets'
a15e375c Fix MFC setting on utility targets (#15867)
2016-01-20 08:33:38 -05:00
Brad King 184be68580 Merge topic 'cache-parse-error-line-number'
77cd74a3 Print line number of cache parse errors (#11109)
2016-01-20 08:33:35 -05:00
Kitware Robot 15fe480bf0 CMake Nightly Date Stamp 2016-01-20 00:01:12 -05:00