Commit Graph

17826 Commits

Author SHA1 Message Date
Brad King dbad49705e Merge topic 'vs-midl-absolute-OutputDirectory'
4ee9005d cmVisualStudio10TargetGenerator: Wrap long line
2015-02-25 09:03:05 -05:00
Brad King b38f535eaa Merge topic 'sln-no-bom'
987d4a12 VS: Do not generate a BOM in .sln files
2015-02-25 09:03:01 -05:00
Kitware Robot 1826aadcf3 CMake Nightly Date Stamp 2015-02-25 00:01:09 -05:00
Brad King 987d4a1240 VS: Do not generate a BOM in .sln files
Revert commit v3.2.0-rc1~165^2 (Encoding:  Write Visual Studio solution
file with BOM, 2014-12-26).  The BOM breaks the VS IDE version selector
when loading the .sln from Windows Explorer.
2015-02-24 13:30:50 -05:00
Brad King 4ee9005d73 cmVisualStudio10TargetGenerator: Wrap long line 2015-02-24 10:34:15 -05:00
Brad King ac80f0f95f Merge topic 'cleanup-cmAlgorithms'
47c2da6a cmAlgorithms: Cache the end iterators in algorithms.
a5b10ae6 cmAlgorithms: Remove needless assignment.
7fd8557f cmAlgorithms: Maintain the pivot iterator in cmRemoveIndices.
1f796791 cmAlgorithms: Relax iterator requirement for cmRemoveIndices.
ba959934 cmAlgorithms: Make cmRemoveDuplicates work with more containers.
cae45df7 cmAlgorithms: Rename template argument to RemoveN.
b917f4c0 cmAlgorithms: Relax cmRemoveN requirement to FwdIter.
bbc1a978 cmAlgorithms: Add a size() to cmRange.
47a3e22e cmAlgorithms: Rename template type in cmDeleteAll algorithm.
cb75eec0 cmAlgorithms: Add const to const objects.
2015-02-24 09:16:53 -05:00
Stephen Kelly 47c2da6aa8 cmAlgorithms: Cache the end iterators in algorithms. 2015-02-24 09:16:02 -05:00
Stephen Kelly a5b10ae68a cmAlgorithms: Remove needless assignment. 2015-02-24 09:16:02 -05:00
Stephen Kelly 7fd8557f4c cmAlgorithms: Maintain the pivot iterator in cmRemoveIndices.
Avoid the algorithm of 'Schlemiel the painter' in the case of
iterators which are not RandomAccess.
2015-02-24 09:16:02 -05:00
Stephen Kelly 1f79679136 cmAlgorithms: Relax iterator requirement for cmRemoveIndices.
Require only forward iterators from the range.
2015-02-24 09:16:02 -05:00
Stephen Kelly ba959934a6 cmAlgorithms: Make cmRemoveDuplicates work with more containers.
Remove the accidental requirement that the input range must be a
std::vector.
2015-02-24 09:16:02 -05:00
Stephen Kelly cae45df772 cmAlgorithms: Rename template argument to RemoveN. 2015-02-24 09:16:01 -05:00
Stephen Kelly b917f4c003 cmAlgorithms: Relax cmRemoveN requirement to FwdIter.
cmRotate already requires only FwdIter.
2015-02-24 09:16:01 -05:00
Stephen Kelly bbc1a9788d cmAlgorithms: Add a size() to cmRange.
size() is already used by cmRemoveDuplicates, which is designed to
accept a cmRange.
2015-02-24 09:16:01 -05:00
Brad King f67b8065f6 Merge topic 'osx-CFBundleExecutable'
78ec4b16 OS X: Shorten CFBundleExecutable to file name only
2015-02-24 09:12:47 -05:00
Brad King 3bda0717b3 Merge topic 'vs-midl-absolute-OutputDirectory'
0b54e836 VS: Specify absolute output directory for the Midl tool
2015-02-24 09:12:41 -05:00
Brad King 206ce77781 Merge topic 'ctest-output-options'
ff1ddd2a ctest_upload: Add QUIET option
0b87b2a3 ctest_memcheck: Add QUIET option
fc58bdb9 ctest_coverage: Add QUIET option
876a680d ctest_test: Add QUIET option
49ba4545 ctest_build: Add QUIET option
f999dc0b ctest_configure: Add QUIET option
645ad117 ctest_update: Add QUIET option
19d1a559 ctest_start: Add QUIET option
1643b905 ctest_submit: Add QUIET option
12db1139 CTest: Add cmCTestOptionalLog macro
2015-02-24 09:12:33 -05:00
Kitware Robot d83b40c58d CMake Nightly Date Stamp 2015-02-24 00:01:16 -05:00
Stephen Kelly 47a3e22ea5 cmAlgorithms: Rename template type in cmDeleteAll algorithm.
It may be any range, not only a container.
2015-02-23 20:19:35 +01:00
Stephen Kelly cb75eec0b4 cmAlgorithms: Add const to const objects. 2015-02-23 20:19:35 +01:00
Tim Blechmann 0b54e8366e VS: Specify absolute output directory for the Midl tool
Generate the OutputDirectory element value as an absolute path
to the same location as the existing relative path.  Somehow
this addresses an occasional failure in a large/complex build,
and should not hurt basic use cases.
2015-02-23 13:22:07 -05:00
Gregor Jasny 78ec4b1640 OS X: Shorten CFBundleExecutable to file name only
Shorten the CFBundleExecutable in the PList file of Bundles to
the file name only as it is done for Frameworks, too.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-02-23 13:07:33 -05:00
Brad King 99575c9ac1 CMake 3.2.0-rc2 2015-02-23 11:10:12 -05:00
Brad King cb16c7844d Merge topic 'wix-shortcut-properties'
6cc01c14 CPackWIX: Add release notes for the wix-shortcut-properties topic.
135febf0 CPackWIX: Enhance CMake CPack WIX generated installer.
e6731f48 CPackWIX: Add new CPACK_STARTUP_SHORTCUTS property.
279605f5 CPackWIX: Add installed file properties for the creation of shortcuts.
53d7daff CPackWIX: Refactor start menu and desktop shortcut creation.
dc0f3fb4 CPackWIX: Explicitly list CPack WIX headers for IDE convenience.
2015-02-23 11:06:07 -05:00
Brad King 9627c5238a Merge topic 'if-optimize'
51f8de81 if(): avoid one needless string compare for all if() statements
2015-02-23 10:26:48 -05:00
Brad King 6dc9a627b6 Merge topic 'minor-cleanups'
c021f59c cmMakefile: Store macro list in a vector not in a map.
2d130896 cmMakefile: Fix list of macros generation.
f1969234 cmFunctionCommand: Remove ineffectual code.
1116698a cmTarget: Don't needlessly clear vectors in the destructor.
2015-02-23 10:26:42 -05:00
Brad King cc3611023d Merge topic 'use-algorithms'
bb9d71b4 Replace loops with algorithms.
4afe6c26 cmAlgorithms: Add cmReverseRange adaptor.
a3a0a8c2 cmAlgorithms: Add cmFindNot algorithm.
8c74a41f cmRST: Replace two erase with a rotate and larger erase.
61fe1919 cmAlgorithms: Update concept requirement to FowardIterator
09d6125b cmAlgorithms: Move cmRotate out of 'implementation detail' namespace.
8ed6ecac cmRST: Move two algorithms beside each other.
dfe49c20 cmRST: Use std::min where appropriate.
21b0654a cmGlobalGenerator: Convert set insert algorithm to vector algorithms.
416df93a Convert some raw loops to cmWrap.
37b88d34 cmAlgorithms: Add cmWrap.
a2818093 Use cmJoin where possible.
76207b08 cmCacheManager: Replace loop with algorithm.
60c3bb73 cmGlobalGenerator: Replace loop with algorithm.
05fec779 cmTarget: Port loop to algorithm.
9c225767 cmGlobalGenerator: Replace set::insert algorithm with cmRemoveDuplicates.
...
2015-02-23 10:26:38 -05:00
Brad King a089c1c903 Merge topic 'cpack-bundle-codesign-output'
7b582d15 CPack: Print output from codesign if signing fails
2015-02-23 10:26:34 -05:00
Brad King 1eb192905d Merge topic 'private-FindJsonCpp'
a41d621d bootstrap: Add --(no-)system-jsoncpp options
a5768442 FindJsonCpp: Drop new module due to upstream jsoncpp providing package
2015-02-23 10:26:30 -05:00
Zack Galbreath ff1ddd2a73 ctest_upload: Add QUIET option 2015-02-23 10:02:00 -05:00
Zack Galbreath 0b87b2a339 ctest_memcheck: Add QUIET option 2015-02-23 10:02:00 -05:00
Zack Galbreath fc58bdb9ad ctest_coverage: Add QUIET option 2015-02-23 10:02:00 -05:00
Zack Galbreath 876a680d48 ctest_test: Add QUIET option 2015-02-23 10:01:59 -05:00
Zack Galbreath 49ba4545c2 ctest_build: Add QUIET option 2015-02-23 10:01:59 -05:00
Zack Galbreath f999dc0bbf ctest_configure: Add QUIET option 2015-02-23 10:01:59 -05:00
Zack Galbreath 645ad117e1 ctest_update: Add QUIET option 2015-02-23 10:01:59 -05:00
Zack Galbreath 19d1a5599a ctest_start: Add QUIET option
This suppresses all non-error messages that would have otherwise
been printed by this function.
2015-02-23 10:01:59 -05:00
Zack Galbreath 1643b905e0 ctest_submit: Add QUIET option
Specifying this option prevents CTest from printing any non-error
messages to the console for this call to ctest_submit().
2015-02-23 10:01:58 -05:00
Zack Galbreath 12db113944 CTest: Add cmCTestOptionalLog macro
cmCTestOptionalLog takes a boolean argument that indicates
whether or not the message should be suppressed.  Note that
error messages will still be printed, even if suppression is
requested.  This macro will allow us to provide more
fine-grained control over what messages CTest prints to the
console.
2015-02-23 10:01:58 -05:00
Kitware Robot 6adff76720 CMake Nightly Date Stamp 2015-02-23 00:01:08 -05:00
Rolf Eike Beer 51f8de8102 if(): avoid one needless string compare for all if() statements
If it's known that it is an "if" it can't be an "elseif".
2015-02-22 13:48:30 +01:00
Kitware Robot 5cf629c3bc CMake Nightly Date Stamp 2015-02-22 00:01:09 -05:00
Nils Gladitz e6731f486e CPackWIX: Add new CPACK_STARTUP_SHORTCUTS property. 2015-02-21 18:07:36 +01:00
Nils Gladitz 279605f560 CPackWIX: Add installed file properties for the creation of shortcuts. 2015-02-21 17:30:31 +01:00
Nils Gladitz 53d7daffac CPackWIX: Refactor start menu and desktop shortcut creation. 2015-02-21 12:38:14 +01:00
Stephen Kelly c021f59c1f cmMakefile: Store macro list in a vector not in a map.
The signature was computed (incorrectly) and stored as the map
value, but never used.  Remove it now.
2015-02-21 11:25:47 +01:00
Stephen Kelly 2d130896a0 cmMakefile: Fix list of macros generation.
It was broken by commit 7ee56f03 (Convert loops into the commonly
used pattern., 2015-01-17).
2015-02-21 11:25:26 +01:00
Stephen Kelly f19692342b cmFunctionCommand: Remove ineffectual code.
The name variable is never used.
2015-02-21 11:02:03 +01:00
Stephen Kelly 1116698a89 cmTarget: Don't needlessly clear vectors in the destructor.
This will be done anyway for us.
2015-02-21 11:00:14 +01:00
Kitware Robot 8804c3e0e4 CMake Nightly Date Stamp 2015-02-21 00:01:16 -05:00
Stephen Kelly bb9d71b4fe Replace loops with algorithms. 2015-02-20 21:36:58 +01:00
Stephen Kelly 4afe6c26c6 cmAlgorithms: Add cmReverseRange adaptor.
Use it to implement list(REVERSE).
2015-02-20 21:36:58 +01:00
Stephen Kelly a3a0a8c222 cmAlgorithms: Add cmFindNot algorithm. 2015-02-20 21:36:58 +01:00
Stephen Kelly 8c74a41ff3 cmRST: Replace two erase with a rotate and larger erase. 2015-02-20 21:36:58 +01:00
Stephen Kelly 61fe1919de cmAlgorithms: Update concept requirement to FowardIterator 2015-02-20 21:36:58 +01:00
Stephen Kelly 09d6125bfe cmAlgorithms: Move cmRotate out of 'implementation detail' namespace.
This should be generally usable in cmake.
2015-02-20 21:36:58 +01:00
Stephen Kelly 8ed6ecac3f cmRST: Move two algorithms beside each other. 2015-02-20 21:36:58 +01:00
Stephen Kelly dfe49c2056 cmRST: Use std::min where appropriate. 2015-02-20 21:36:58 +01:00
Stephen Kelly 21b0654ace cmGlobalGenerator: Convert set insert algorithm to vector algorithms.
Adjust test for new error output.
2015-02-20 21:36:57 +01:00
Stephen Kelly 416df93aa9 Convert some raw loops to cmWrap. 2015-02-20 21:36:57 +01:00
Stephen Kelly 37b88d348a cmAlgorithms: Add cmWrap.
Port some existing cmJoin to use it.

cmJoin is cumbersome to use in cases where the objective is to
somehow 'quote' each item and then join it with a separator.  In that
case, the joiner string is harder to read and reason about.  cmWrap
aims to solve that.

Provide an overload taking char wrappers to simplify the case
of surrounding every element in quotes without needing to escape
the quote character.
2015-02-20 21:35:58 +01:00
Stephen Kelly a281809384 Use cmJoin where possible. 2015-02-20 21:26:18 +01:00
Stephen Kelly 76207b0861 cmCacheManager: Replace loop with algorithm. 2015-02-20 21:26:18 +01:00
Stephen Kelly 60c3bb73e3 cmGlobalGenerator: Replace loop with algorithm. 2015-02-20 21:26:18 +01:00
Stephen Kelly 05fec779d3 cmTarget: Port loop to algorithm. 2015-02-20 21:26:17 +01:00
Nils Gladitz dc0f3fb44f CPackWIX: Explicitly list CPack WIX headers for IDE convenience. 2015-02-20 17:51:55 +01:00
André Klitzing 7b582d15ff CPack: Print output from codesign if signing fails 2015-02-20 08:17:53 -07:00
Brad King 57d4e1c776 Merge branch 'private-FindJsonCpp' into release 2015-02-20 08:33:03 -05:00
Brad King a576844263 FindJsonCpp: Drop new module due to upstream jsoncpp providing package
Since jsoncpp 0.7.0 (2014-11-20) the upstream may provide a CMake
package configuration file such that find_package(jsoncpp) will find a
jsoncppConfig.cmake file.  In order to avoid conflicting with this
(especially on case-insensitive filesystems), and since we always prefer
projects to provide package config files (that they maintain), it is
better to not provide FindJsonCpp publicly.

Move FindJsonCpp into a private source directory that is not installed
so that we can still use it for building CMake itself.

Reported-by: Ryan Pavlik <ryan.pavlik@gmail.com>
2015-02-20 08:22:02 -05:00
Brad King c4c570f9cc Merge topic 'find-command-prefix-from-PATH'
ffc06c12 Teach find_(library|file|path) to get prefixes from PATH (#15370)
2015-02-20 08:10:50 -05:00
Brad King b7351d8e14 Merge topic 'cmake-gui-reset-generator-toolset-and-platform'
1ade687d cmake-gui: Reset generator platform and toolset on configure (#15411)
2015-02-20 08:10:48 -05:00
Kitware Robot 14713eebfb CMake Nightly Date Stamp 2015-02-20 00:01:16 -05:00
Brad King ffc06c1239 Teach find_(library|file|path) to get prefixes from PATH (#15370)
The find_package command already knows how to compute installation
prefixes from PATH.  Use the same approach to establish prefixes for
find_library, find_file, and find_path to use to look in directories
like "<prefix>/lib[/<arch>]" and "<prefix>/include" for libraries and
headers.  This will reduce the amount of configuration end users need to
do to establish a work environment rooted under a specific prefix.
2015-02-19 10:03:17 -05:00
Brad King 1ade687d8d cmake-gui: Reset generator platform and toolset on configure (#15411)
At the start of each configure step we already reset the generator
selection (CMAKE_GENERATOR) to match that loaded for the current
project.  Add missing code to reset the generator platform and toolset
(CMAKE_GENERATOR_PLATFORM and CMAKE_GENERATOR_TOOLSET) also so that they
do not leak across projects.
2015-02-19 09:14:38 -05:00
Kitware Robot f7fc99cec6 CMake Nightly Date Stamp 2015-02-19 00:01:10 -05:00
Stephen Kelly 9c22576787 cmGlobalGenerator: Replace set::insert algorithm with cmRemoveDuplicates. 2015-02-19 00:59:19 +01:00
Stephen Kelly ee5bc006eb cmGeneratorTarget: Replace set insert algorithm with cmRemoveDuplicates. 2015-02-19 00:59:19 +01:00
Stephen Kelly b3a0c6e08f cmLocalGenerator: Convert loop to algorithm. 2015-02-19 00:59:19 +01:00
Stephen Kelly f20a4257f2 cmMakefile: Add flag to result and manipulate in place.
Rather than creating a string, manipulating it, and then
copying it to the result.
2015-02-18 23:57:59 +01:00
Stephen Kelly ee269f4f16 cmMakefile: Replace two loops with std::replace. 2015-02-18 23:45:19 +01:00
Stephen Kelly 470cff497b cmMakefile: Replace loop with composed algorithm. 2015-02-18 23:45:18 +01:00
Stephen Kelly e6ca1b8274 cmCTest: Convert loop to member insert. 2015-02-18 21:36:35 +01:00
Brad King 93a38a2abc Merge topic 'minor-cleanups'
6652afe6 CTest: Use clear instead of erase-all.
75661fdf cmListCommand: Move size variable out of loop.
10e53e23 cmAlgorithms: Add missing const to functors.
74906322 cmAlgorithms: Remove sort of already-sorted container.
2acd04c9 cmcmd: Remove some comment copy-pasta.
2d833232 cmCoreTryCompile: Remove variable assignment.
26602cf5 cmLocalGenerator: Move variable population inside of condition.
cfb84834 Update comment to match recent dashboard testing.
6010f936 Revert "cmGlobalGenerator: Fix value type pushed into autogens vector"
0550b9e3 Revert "Attempt to fix the compile of cmake on Sun CC."
1ee4721f Help: Fix formatting of command parameter.
62429a1e cmGlobalGenerator: Remove unneeded pointer check.
c697c1fa cmTarget: Remove template argument workaround.
2015-02-18 12:49:29 -05:00
Kitware Robot 4fb9e847c0 CMake Nightly Date Stamp 2015-02-18 00:01:09 -05:00
Stephen Kelly 6652afe669 CTest: Use clear instead of erase-all. 2015-02-17 20:18:59 +01:00
Stephen Kelly 75661fdfd9 cmListCommand: Move size variable out of loop.
Re-use it where possible in two instances.
2015-02-17 20:18:58 +01:00
Stephen Kelly 10e53e2308 cmAlgorithms: Add missing const to functors. 2015-02-17 20:18:57 +01:00
Stephen Kelly 7490632258 cmAlgorithms: Remove sort of already-sorted container.
The indices is populated by an increasing number.
2015-02-17 20:18:57 +01:00
Stephen Kelly 2acd04c966 cmcmd: Remove some comment copy-pasta. 2015-02-17 20:18:56 +01:00
Stephen Kelly 2d833232a3 cmCoreTryCompile: Remove variable assignment.
The variable is not a reference, and we return in the same scope
after assigning, so it has no effect.
2015-02-17 19:23:27 +01:00
Stephen Kelly 26602cf56c cmLocalGenerator: Move variable population inside of condition.
It is only used in the condition, so no need to look for uses
elsewhere when reading the code.
2015-02-17 19:21:36 +01:00
Stephen Kelly cfb8483412 Update comment to match recent dashboard testing. 2015-02-17 19:20:23 +01:00
Stephen Kelly 6010f93632 Revert "cmGlobalGenerator: Fix value type pushed into autogens vector"
This reverts commit ae6fc555a7.

Use the more-natural make_pair algorithm.  The compiler motivating
the need for this is not supported as a host anymore.
2015-02-17 19:19:06 +01:00
Stephen Kelly 0550b9e330 Revert "Attempt to fix the compile of cmake on Sun CC."
This reverts commit a573a85658.

The workaround is not needed on supported SolarisStudio compilers.
2015-02-17 19:18:12 +01:00
Stephen Kelly 62429a1e54 cmGlobalGenerator: Remove unneeded pointer check.
Deleting nullptr is ok.
2015-02-17 19:18:11 +01:00
Stephen Kelly c697c1fafe cmTarget: Remove template argument workaround.
Pre-C++98 compilers required that the template argument be
used in the function parameters.  Those compilers are no longer
supported as hosts, so drop the workaround.
2015-02-17 19:18:11 +01:00
Brad King 5c635fa624 Merge topic 'vs7-OutputDirectory'
fa8b30eb VS: Fix .vcproj and .vfproj file OutputDirectory generation
aa2ba121 VS: Use $(ConfigurationName) as CMAKE_CFG_INTDIR in VS 7, 8, 9
2015-02-17 10:09:13 -05:00
Kitware Robot 034f8e0bd9 CMake Nightly Date Stamp 2015-02-17 00:01:08 -05:00
Brad King fa8b30ebb5 VS: Fix .vcproj and .vfproj file OutputDirectory generation
Teach cmLocalVisualStudio7Generator to set 'OutputDirectory' using the
same method as is used to set the 'OutputFile' in the generated project
file.  Also, OutputDirectory only needs to be set for targets that run the
linker or librarian.  These two changes make the VS 7 OutputDirectory
consistent with what cmVisualStudio10TargetGenerator generates for OutDir.

Without this, since the VS Intel Fortran plugin for VS >= 10 still uses
the VS 7 .vfproj file format, when executing test VSGNUFortran using
Intel Fortran Compiler 15.xx, the following warning is issued just
before compilation:

  TargetPath(...) does not match the Linker's OutputFile property value (...).
  This may cause your project to build incorrectly.
  To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt)
  property values match the value specified in %(Link.OutputFile).

Subsequently, an error is reported during linking.

Inspired-by: Vincent Newsum <vynewsum@gmail.com>
2015-02-16 11:48:16 -05:00
Brad King aa2ba12164 VS: Use $(ConfigurationName) as CMAKE_CFG_INTDIR in VS 7, 8, 9
This will allow us to use a value other than just the config name
for the project OutputDirectory setting used for $(OutDir).

Also use $(ConfigurationName) instead of $(OutDir) for the link
directory configuration suffix since that is a hard-coded instance of
a use case for CMAKE_CFG_INTDIR.
2015-02-16 11:48:04 -05:00
Brad King ec1ec47193 Merge topic 'cmListCommand-algorithms'
116459d3 cmListCommand: Avoid needlessly erasing from vectors.
1c7c35c3 cmListCommand: Replace remove duplicates loop with algorithm.
cebeed24 cmAlgorithms: Add cmRemoveDuplicates algorithm.
3cfe7a4c cmListCommand: Implement REMOVE_ITEM in terms of cmRemoveMatching.
050958a3 cmAlgorithms: Add cmRemoveMatching algorithm.
a77af8f1 cmListCommand: Replace joining loop with cmJoin algorithm.
6a22e401 cmListCommand: Use cmRemoveIndices for REMOVE_AT subcommand.
0b5cf0da cmAlgorithms: Implement algorithm for removing indexes.
069f2440 cmListCommand: Convert loop to find algorithm.
67a26764 cmListCommand: Implement REVERSE subcommand with std::reverse.
1cecd3a5 cmListCommand: Use std::find algorithm for FIND subcommand.
2015-02-16 09:44:44 -05:00
Brad King 7747e1a7f6 Merge topic 'wix-product-fragment'
a2ccbffd CPackWIX: Extend the patching mechanism to allow adding content to <Product>.
2015-02-16 09:44:40 -05:00
Kitware Robot f724ab5e78 CMake Nightly Date Stamp 2015-02-16 00:01:09 -05:00
Stephen Kelly 116459d34f cmListCommand: Avoid needlessly erasing from vectors.
The entire vector will be destroyed at once at the end of the scope,
and the remove algorithms already give us the end of the range of
interesting values, so just use those sentinals.
2015-02-15 20:47:51 +01:00
Stephen Kelly 1c7c35c372 cmListCommand: Replace remove duplicates loop with algorithm. 2015-02-15 20:47:51 +01:00
Stephen Kelly cebeed2486 cmAlgorithms: Add cmRemoveDuplicates algorithm.
Start by creating a vector to hold a unique values of the input range.  We
expect that in most cases, there will be relatively few duplicates, so
reserving enough memory for a complete copy is worthwhile.  Unlike a solution
involving a std::set, this algorithm allocates all the memory it needs
in one go and in one place, so it is more cache friendly.

Populate the unique copy with a lower_bound insert algorithm and record the
indices of duplicates.  This is the same complexity as the std::set insert
algorithm, but without the need to allocate memory on the heap and other
disadvantages of std::set.

Remove the duplicates with the cmRemoveIndices algorithm.
2015-02-15 20:46:25 +01:00
Stephen Kelly 3cfe7a4ca8 cmListCommand: Implement REMOVE_ITEM in terms of cmRemoveMatching. 2015-02-15 19:56:09 +01:00
Stephen Kelly 050958a328 cmAlgorithms: Add cmRemoveMatching algorithm.
Implement it in terms of std::remove_if with a binary search through
a matching range.
2015-02-15 19:56:08 +01:00
Stephen Kelly a77af8f130 cmListCommand: Replace joining loop with cmJoin algorithm. 2015-02-15 19:56:07 +01:00
Stephen Kelly 6a22e40147 cmListCommand: Use cmRemoveIndices for REMOVE_AT subcommand.
Avoid repeatedly looping over the indices to process elements (even
without breaking out of the loop when the element is found).
2015-02-15 19:55:28 +01:00
Stephen Kelly 0b5cf0dabd cmAlgorithms: Implement algorithm for removing indexes.
Implement ContainerAlgorithms::RemoveN to remove N elements to the
end of a container by rotating.  The rotate is implemented in terms
of the efficient swap algorithm, optimized even more in the standard
library implementation when the compiler supports the rvalue-references
feature to move elements.  Implement cmRemoveN with a Range API
for completeness.

std::rotate in C++11 is specified to return an iterator, but
c++98 specifies it to return void.  libstdc++ 5.0 will be the first
version to have the correct return type.  Implement
ContainerAlgorithms::Rotate in terms of std::rotate and return the
correct iterator from it.  While std::rotate requires forward iterators,
 this workaround means cmRotate requires bidirectional iterators.  As
most of CMake uses random access iterators anyway, this should not
be a problem.

Implement cmRemoveIndices in terms of the RemoveN algorithm, such
that each element which is not removed is rotated only once.  This
can not use the cmRemoveN range-API algorithm because that would
require creating a new range, but the range must be taken by reference
and so it can't be a temporary.

These remove algorithms are not part of the STL and I couldn't find them
anywhere else either.
2015-02-15 19:04:31 +01:00
Stephen Kelly 069f2440c4 cmListCommand: Convert loop to find algorithm. 2015-02-15 19:04:30 +01:00
Stephen Kelly 67a26764b5 cmListCommand: Implement REVERSE subcommand with std::reverse. 2015-02-15 18:57:23 +01:00
Stephen Kelly 1cecd3a531 cmListCommand: Use std::find algorithm for FIND subcommand.
Use a ostringstream to account for the input being a variable of type
size_t as a result of using std::distance.  There is no single
format string which portably accepts a size_t.
2015-02-15 14:28:50 +01:00
Kitware Robot fd8112ea7c CMake Nightly Date Stamp 2015-02-15 00:01:08 -05:00
Kitware Robot feb76254c5 CMake Nightly Date Stamp 2015-02-14 00:01:14 -05:00
Brad King d6616181c8 Merge topic 'clean-up-cmFunctionCommand'
78757e7f cmFunctionCommand: Replace loops with cmJoin.
fc1cf265 cmFunctionCommand: Remove counting variable.
e5ebeae7 cmFunctionCommand: Split loop in two.
2015-02-13 11:03:00 -05:00
Brad King cc90fd58ec Merge topic 'xcode-attribute-genex'
bf8f9c29 Xcode: Teach XCODE_ATTRIBUTE target properties about generator expressions
2015-02-13 11:02:58 -05:00
Nils Gladitz a2ccbffd8b CPackWIX: Extend the patching mechanism to allow adding content to <Product>. 2015-02-13 12:09:40 +01:00
Kitware Robot 8d38ff05e2 CMake Nightly Date Stamp 2015-02-13 00:01:16 -05:00
Stephen Kelly 78757e7ffc cmFunctionCommand: Replace loops with cmJoin. 2015-02-12 20:25:21 +01:00
Stephen Kelly fc1cf2654d cmFunctionCommand: Remove counting variable.
Start iteration at correct starting point directly.
2015-02-12 20:25:21 +01:00
Stephen Kelly e5ebeae768 cmFunctionCommand: Split loop in two. 2015-02-12 20:25:20 +01:00
Gregor Jasny bf8f9c29e7 Xcode: Teach XCODE_ATTRIBUTE target properties about generator expressions
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-02-12 13:35:31 -05:00
Brad King 32821bb319 Merge topic 'clean-up-cmMacroCommand'
b5f98e50 cmMacroCommand: Manipulate target string directly.
83414d5a cmMacroCommand: Move computation of ARGV%n names out of double loop.
9a1f8f35 cmMacroCommand: Move ARGV replacement out of condition.
4aa7bd2a cmMacroCommand: Remove condition around ARGN replacement.
6774c92b cmMacroCommand: Declare tmps in the scope that it's used.
2c4a7298 cmMacroCommand: Declare arg in the scope that it is used.
a551851a cmMacroCommand: Inline variable computation.
f79c0f76 cmMacroCommand: Compute variables outside of two loops.
8e0827b6 cmMacroCommand: Remove intermediate arg variables.
f2c49f59 cmMacroCommand: Remove condition around ARGN computation.
3250a7e5 cmMacroCommand: Remove conditional append of semicolon.
081a13f7 cmMacroCommand: Declare arg variables where used and initialized.
17b5ebd3 cmMacroCommand: Join the args strings outside of the loops.
2015-02-12 11:53:11 -05:00
Brad King e6ae3c6ae0 Merge topic 'use-cmRange'
7c3f6376 Convert loop into two algorithms.
8a399c8c Convert loop to the common pattern.
abfca975 Move loop inside of condition.
0b61b86d Handle last element outside of the loop.
e21f7829 cmTarget: Use a sorted vector in place of a set.
559dc155 cmSet: Replace loop with cmJoin.
0ea71932 cmFindBase: Replace loop with cmJoin on range.
9380e85f Convert loops to cmJoin algorithm with cmRange.
bb10012f cmStringCommand: Accumulate with cmJoin and range adaptors.
0c12f1ea cmAlgorithms: Add a range adaptor and API for adjusting a range.
27c6f017 Use cmJoin to accumulate string ranges.
4e78ebbd cmAlgorithms: Add a Range container and adaptor method.
89102249 Replace common loop pattern with cmJoin
7b8725bf Convert loops populating maybe-empty content into the common pattern.
7ee56f03 Convert loops into the commonly used pattern.
0a4e5674 cmMacroCommand: Remove counting variable.
...
2015-02-12 11:53:04 -05:00
Brad King fc7e15691a Merge topic 'install-DESTINATION-genex'
f30022eb install: Allow generator expressions in TARGETS DESTINATION (#14317)
7607c3d1 cmInstallGenerator: Pass destination explicitly to AddInstallRule
ebd556ca cmInstallGenerator: Fix check for absolute install destinations
290ca8e2 cmInstallGenerator: Refactor computation of absolute install dest
f99991db cmInstallGenerator: Move GetDestination to subclasses that need it
2015-02-12 11:53:02 -05:00
Kitware Robot 09cdcc5430 CMake Nightly Date Stamp 2015-02-12 00:01:15 -05:00
Stephen Kelly b5f98e5012 cmMacroCommand: Manipulate target string directly.
Avoid copying a string from the source, manipulating it, and then
copying it back.  Manipulate it in place instead.
2015-02-11 22:58:34 +01:00
Stephen Kelly 83414d5a07 cmMacroCommand: Move computation of ARGV%n names out of double loop. 2015-02-11 22:58:34 +01:00
Stephen Kelly 9a1f8f35f4 cmMacroCommand: Move ARGV replacement out of condition. 2015-02-11 22:58:34 +01:00
Stephen Kelly 4aa7bd2ac1 cmMacroCommand: Remove condition around ARGN replacement.
There is none for ARGC replacement, so no reason to conditionalize the
replacement.  The computation is already done.
2015-02-11 22:58:34 +01:00
Stephen Kelly 6774c92b58 cmMacroCommand: Declare tmps in the scope that it's used.
We don't particularly need to reuse the string memory here, and this
pattern is not common in CMake.
2015-02-11 22:58:34 +01:00
Stephen Kelly 2c4a7298fc cmMacroCommand: Declare arg in the scope that it is used.
It can make sense to declare objects outside of loops if
the size required by the object can grow (eg std::string when
using getline), but that is not the case here.
2015-02-11 22:58:34 +01:00
Stephen Kelly a551851ab3 cmMacroCommand: Inline variable computation. 2015-02-11 22:58:33 +01:00
Stephen Kelly f79c0f7697 cmMacroCommand: Compute variables outside of two loops.
Avoid computing them from scratch for each argument of each
function.
2015-02-11 22:58:33 +01:00
Stephen Kelly 8e0827b646 cmMacroCommand: Remove intermediate arg variables. 2015-02-11 22:58:33 +01:00
Stephen Kelly f2c49f59d8 cmMacroCommand: Remove condition around ARGN computation.
An empty string is appended if the condition is false, which is
ok for this commit.
2015-02-11 22:58:33 +01:00
Stephen Kelly 3250a7e535 cmMacroCommand: Remove conditional append of semicolon.
The conditions are never true.
2015-02-11 22:58:33 +01:00
Stephen Kelly 081a13f7c0 cmMacroCommand: Declare arg variables where used and initialized.
Make the initialization by population with the expanded* content
unconditional.
2015-02-11 22:58:33 +01:00
Stephen Kelly 17b5ebd383 cmMacroCommand: Join the args strings outside of the loops.
This means that we compute the strings even if not used in the macro
but this shouldn't be expensive and it simplifies the code.
2015-02-11 22:58:31 +01:00
Stephen Kelly 7c3f637680 Convert loop into two algorithms. 2015-02-11 22:58:09 +01:00
Stephen Kelly 8a399c8c9f Convert loop to the common pattern. 2015-02-11 22:58:09 +01:00
Stephen Kelly abfca97525 Move loop inside of condition.
The loop is only executed if the condition is true.
2015-02-11 22:58:09 +01:00
Stephen Kelly 0b61b86df8 Handle last element outside of the loop.
There is no point in checking on each loop iteration whether
it is the last element.
2015-02-11 22:58:08 +01:00
Stephen Kelly e21f7829a2 cmTarget: Use a sorted vector in place of a set.
The vector has a more easy-to-use API.

Join the string with cmJoin, and avoid erasing from the container
in the loop.
2015-02-11 22:58:08 +01:00
Stephen Kelly 559dc15589 cmSet: Replace loop with cmJoin. 2015-02-11 22:58:08 +01:00
Stephen Kelly 0ea719326e cmFindBase: Replace loop with cmJoin on range. 2015-02-11 22:58:08 +01:00
Stephen Kelly 9380e85f86 Convert loops to cmJoin algorithm with cmRange. 2015-02-11 22:58:04 +01:00
Stephen Kelly bb10012fea cmStringCommand: Accumulate with cmJoin and range adaptors. 2015-02-11 22:57:56 +01:00
Stephen Kelly 0c12f1ea0d cmAlgorithms: Add a range adaptor and API for adjusting a range. 2015-02-11 22:57:55 +01:00
Stephen Kelly 27c6f017a1 Use cmJoin to accumulate string ranges.
Avoid using the std::accumulate algorithm which is designed for
numeric types, not complex types.  It introduces unneccessary
copies.

Initialize variables where they are populated.
2015-02-11 22:57:55 +01:00
Stephen Kelly 4e78ebbdf9 cmAlgorithms: Add a Range container and adaptor method.
This can make a pair of iterators API compatible with the
cmJoin algorithm and other range-based algorithms.

Accept different iterator types in the cmRange adaptor so that
a const and non-const iterator are accepted.
2015-02-11 22:57:55 +01:00
Stephen Kelly 8910224950 Replace common loop pattern with cmJoin 2015-02-11 22:57:55 +01:00
Stephen Kelly 7b8725bf84 Convert loops populating maybe-empty content into the common pattern. 2015-02-11 22:57:53 +01:00
Stephen Kelly 7ee56f0399 Convert loops into the commonly used pattern. 2015-02-11 22:57:41 +01:00
Stephen Kelly 0a4e5674ec cmMacroCommand: Remove counting variable.
Start iteration at correct starting point directly.
2015-02-11 22:57:38 +01:00
Brad King f30022eb07 install: Allow generator expressions in TARGETS DESTINATION (#14317)
This will allow per-config destinations for targets in EXPORT sets.
Using multiple install(TARGETS) with separate CONFIGURATIONS is
rejected as a target appearing more than once in an export set.
Now instead one can write

 install(TARGETS foo EXPORT exp DESTINATION lib/$<CONFIG>)

to get a single logical membership of the target in the export set
while still having a per-config destination.
2015-02-11 15:15:33 -05:00
Brad King 7607c3d16a cmInstallGenerator: Pass destination explicitly to AddInstallRule
This will allow specific invocations to transform the destination
before AddInstallRule uses it.
2015-02-11 15:14:01 -05:00
Brad King ebd556caa9 cmInstallGenerator: Fix check for absolute install destinations
In AddInstallRule, check for absolute install destinations before
converting to the absolute install destination.  Previously this
worked only by accident because literal "${CMAKE_INSTALL_PREFIX}"
looks like a relative path.
2015-02-11 15:13:57 -05:00
Brad King 290ca8e2d0 cmInstallGenerator: Refactor computation of absolute install dest
Replace the GetInstallDestination method, which looked up the
Destination ivar, with a new ConvertToAbsoluteDestination method that
takes the nominal destination as an argument.  Update call sites
accordingly.  This will allow some clients to transform the install
destination before calling the method.
2015-02-11 15:12:16 -05:00
Brad King f99991db88 cmInstallGenerator: Move GetDestination to subclasses that need it
The method is used only for EXPORT and TARGET install destinations.
While at it, make it return a std::string by reference instead of a
"const char*".
2015-02-11 15:05:57 -05:00
Stephen Kelly 11ecc31d0a cmMacroCommand: Execute loop only if it has an effect. 2015-02-11 20:51:06 +01:00
Stephen Kelly f95543f8a6 cmMacroCommand: Extract iteration starting point. 2015-02-11 20:51:06 +01:00
Stephen Kelly 9fe8f49353 cmMacroCommand: Replace a loop with cmJoin. 2015-02-11 20:51:06 +01:00
Brad King 108e94ecf1 Merge topic 'export-interface-source-files'
f7e33820 Add release notes for export-interface-source-files.
6da65b39 Allow export of targets with INTERFACE_SOURCES.
736bcb96 Tests: Move IfacePaths test stderr files.
d9f8390d Tests: Run IfacePaths tests with a parameter.
cc152094 Tests: Split part of include_directories test to a generic location.
2015-02-11 09:59:30 -05:00
Brad King 0e6af85263 Merge topic 'try_compile-shorter-names'
f3e9eeed try_compile: Use shorter test executable name with consistent length
2015-02-11 09:59:20 -05:00
Brad King 939167a65c Merge topic 'makefile-missing-comment'
eeb2831b Makefile: Fix regression in target-bound custom command COMMENT output
2015-02-11 09:59:18 -05:00
Kitware Robot 1979330188 CMake Nightly Date Stamp 2015-02-11 00:01:09 -05:00
Stephen Kelly 6da65b3907 Allow export of targets with INTERFACE_SOURCES.
Use the same rules for paths in source and binary dirs in
installed INTERFACE_SOURCES as are used for
INTERFACE_INCLUDE_DIRECTORIES.
2015-02-11 00:51:34 +01:00
Stephen Kelly ac26d4b343 Split cmAlgorithms into a separate header file. 2015-02-10 22:14:18 +01:00
Brad King cbffbf7437 Merge topic 'cmStandardIncludes-cleanup'
af65da0a cmStandardIncludes: Remove list include.
e848cc50 cmStandardIncludes: Remove deque include.
5fea6898 cmStandardIncludes: Remove some VS6 workarounds.
2015-02-10 12:56:08 -05:00
Brad King f3e9eeedf4 try_compile: Use shorter test executable name with consistent length
Since commit v2.8.8~176^2 (try_compile: Use random executable file name,
2012-02-13) the length of the test executable name in generated
try_compile projects has been longer and unpredictable.  With Visual
Studio on windows, the tools try to create paths like:

 CMakeFiles/CMakeTmp/$tgt.dir/Debug/$tgt.tlog/$tgt.lastbuildstate

With the target name repeated up to 3 times, we must make it short and
of consistent length to avoid overrunning the 260 character limit
imposed by VS tools.
2015-02-10 10:28:41 -05:00
Brad King 001cd08187 Merge branch 'makefile-missing-comment' into release 2015-02-10 09:46:23 -05:00
Brad King e2619c13f7 Merge topic 'use-algorithms'
d8639733 cmSystemTools: Remove unnecessary comparison.
803317aa cmSystemTools: Early return if size makes later comparison false.
11093a03 Replace temporary bool by inlining warning condition.
6cd2ee95 Replace loop with member algorithm.
94e993a0 cmComputeLinkDepends: Remove temporary iterator copy.
69dbe51b Replace loop with algorithm.
683fafea Replace a loop with std::transform.
63f584b6 Replace while loop with member insert.
74c4d9d2 Take a size check outside of an inner loop.
71d47115 Use insert member instead of back_inserter.
39622c99 Convert while loop to member insert.
a7fcc148 Convert loop to algorithm.
d46c4f07 Extract a prefix variable from loop.
d59913f0 Take computation out of loop.
3f3db744 cmMakefile: Remove ExpandSourceListArguments.
bd990c80 Remove use of ExpandSourceListArguments.
...
2015-02-10 09:37:57 -05:00
Brad King c548ddc172 Merge topic 'makefile-progress-improvements'
63668954 Help: Add notes for topic 'makefile-progress-improvements'
ae775fe8 Makefile: Change link step message color to bold green
7bb50e4a Makefile: Add progress to link step messages
c6ada827 Makefile: Print all color escape sequences before newline
8521fdf5 Makefile: Fix output during parallel builds (#12991)
69ac6d27 bootstrap: Enable color Makefile output
2015-02-10 09:37:55 -05:00
Brad King 1d6f4b6fcc Merge topic 'try_compile-quote-module-path'
220c427e try_compile: Quote the content of CMAKE_MODULE_PATH to allow for spaces
2015-02-10 09:37:53 -05:00
Brad King db9a2e8966 Merge topic 'no-global-setlocale'
0f870234 Merge branch 'backport-no-global-setlocale' into no-global-setlocale
cd408d93 Add setlocale() calls around use of libarchive APIs (#14934, #15377)
87be2e14 Do not call setlocale() globally in CMake applications (#15377)
2015-02-10 09:37:50 -05:00
Brad King 06e527b36c Merge topic 'xcode-flags-per-language'
d2fe4c42 cmGlobalXCodeGenerator: Rename variable 'lang' => 'llang'
de63ff48 Xcode: Generate Intel Fortran compiler flags in project files
9924486f Xcode: Refactor generation of per-language compiler flags
2015-02-10 09:37:46 -05:00
Nils Gladitz eeb2831b5f Makefile: Fix regression in target-bound custom command COMMENT output
Fix a logic typo introduced by commit v3.1.0-rc1~781^2 (Generalize
cmCustomCommandGenerator to more fields, 2014-03-10).
2015-02-10 09:22:05 -05:00
Kitware Robot 7ab4fb5760 CMake Nightly Date Stamp 2015-02-10 00:01:07 -05:00
Nils Gladitz 220c427e84 try_compile: Quote the content of CMAKE_MODULE_PATH to allow for spaces 2015-02-09 10:51:22 +01:00
Kitware Robot 9bbfe76d2c CMake Nightly Date Stamp 2015-02-09 00:01:09 -05:00
Kitware Robot d30036cfad CMake Nightly Date Stamp 2015-02-08 00:01:08 -05:00
Kitware Robot 8b7e5e5996 CMake Nightly Date Stamp 2015-02-07 00:01:09 -05:00
Brad King ae775fe804 Makefile: Change link step message color to bold green
Avoid displaying red messages when no error has occurred.
2015-02-06 19:07:56 -05:00
Brad King 7bb50e4a31 Makefile: Add progress to link step messages 2015-02-06 19:07:24 -05:00
Brad King c6ada8275b Makefile: Print all color escape sequences before newline
Ensure that the escape sequences do not leak across lines.
2015-02-06 16:41:51 -05:00
Brad King 8772420e2f Merge branch 'no-global-setlocale' into release 2015-02-06 13:38:41 -05:00
Brad King 0f870234fe Merge branch 'backport-no-global-setlocale' into no-global-setlocale
Resolve conflict in Source/CMakeLists.txt by taking both changes.
2015-02-06 13:35:21 -05:00
Brad King cd408d93fd Add setlocale() calls around use of libarchive APIs (#14934, #15377)
The libarchive APIs use nl_langinfo(CODESET) for iconv so they need the
locale to be set for LC_CTYPE.  However, the rest of CMake does not
define any behavior for non-ASCII character classification/conversion so
we do not want to setlocale() globally.  Add a RAII class to save, set,
and restore the locale around calls to libarchive APIs.

Inspired-by: Clinton Stimpson <clinton@elemtech.com>
2015-02-06 13:32:57 -05:00
Brad King 87be2e1427 Do not call setlocale() globally in CMake applications (#15377)
Revert the changes made by commit v3.1.0-rc1~406^2~1 (Encoding: Add
setlocale() to applications, 2014-05-30) and commit v3.1.0-rc1~406^2
(Encoding: Change to only set LC_CTYPE, 2014-06-11), and other setlocale
calls added later in their spirit.  CMake has not been taught how to
deal with non-C locales everywhere.  We do not define any functionality
for character conversions for non-ASCII strings.  Another solution will
be needed to address the original problem motivating addition of
setlocale() calls.
2015-02-06 13:32:26 -05:00
Stephen Kelly af65da0aa9 cmStandardIncludes: Remove list include.
Include it only where used.
2015-02-06 19:04:53 +01:00
Stephen Kelly e848cc5074 cmStandardIncludes: Remove deque include.
Include it only where used.
2015-02-06 19:04:53 +01:00
Stephen Kelly 5fea689834 cmStandardIncludes: Remove some VS6 workarounds.
Added in commit v2.6.0~2824 (COMP: Fix warnings in system headers
on VS6., 2006-08-29), but no longer needed.
2015-02-06 19:04:53 +01:00
Stephen Kelly d8639733a4 cmSystemTools: Remove unnecessary comparison.
We already know the string is uppercase.
2015-02-06 19:04:10 +01:00
Stephen Kelly 803317aab6 cmSystemTools: Early return if size makes later comparison false. 2015-02-06 19:04:10 +01:00
Stephen Kelly 11093a03e0 Replace temporary bool by inlining warning condition. 2015-02-06 19:04:10 +01:00
Stephen Kelly 6cd2ee9524 Replace loop with member algorithm. 2015-02-06 19:04:10 +01:00
Stephen Kelly 94e993a0c1 cmComputeLinkDepends: Remove temporary iterator copy. 2015-02-06 19:04:10 +01:00