Commit Graph

17603 Commits

Author SHA1 Message Date
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 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 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
Stephen Kelly 69dbe51b08 Replace loop with algorithm. 2015-02-06 19:04:10 +01:00
Stephen Kelly 683fafea08 Replace a loop with std::transform. 2015-02-06 19:04:09 +01:00
Stephen Kelly 63f584b618 Replace while loop with member insert. 2015-02-06 19:04:09 +01:00
Stephen Kelly 74c4d9d27a Take a size check outside of an inner loop. 2015-02-06 19:04:09 +01:00
Stephen Kelly 71d47115d0 Use insert member instead of back_inserter. 2015-02-06 19:04:09 +01:00
Stephen Kelly 39622c995c Convert while loop to member insert. 2015-02-06 19:04:09 +01:00
Stephen Kelly a7fcc148bd Convert loop to algorithm. 2015-02-06 19:04:09 +01:00
Stephen Kelly d46c4f0727 Extract a prefix variable from loop. 2015-02-06 19:04:08 +01:00
Stephen Kelly d59913f001 Take computation out of loop. 2015-02-06 19:04:08 +01:00
Brad King d2fe4c4203 cmGlobalXCodeGenerator: Rename variable 'lang' => 'llang'
In CreateBuildSettings the variable holds the linker language.
Use a more distinctive variable name.
2015-02-06 11:46:03 -05:00
Brad King de63ff489d Xcode: Generate Intel Fortran compiler flags in project files 2015-02-06 11:45:28 -05:00
Brad King 9924486f8a Xcode: Refactor generation of per-language compiler flags 2015-02-06 11:44:41 -05:00
Brad King 8521fdf56e Makefile: Fix output during parallel builds (#12991)
Replace use of separate "cmake -E cmake_progress_report" and "cmake -E
cmake_echo_color" commands to report the progress and message portions
of build output lines with --progress-* options to the latter to print
everything with a single command.  The line buffering of the stdout FILE
stream should cause the whole line to be printed with one atomic write.
This will avoid inter-mixing of line-wise messages from different
processes during a parallel build.
2015-02-06 08:36:51 -05:00
Kitware Robot 3f73531d4e CMake Nightly Date Stamp 2015-02-06 00:01:16 -05:00
Brad King 69ac6d2755 bootstrap: Enable color Makefile output
Build the needed infrastructure during bootstrap in order to allow
"cmake -E cmake_echo_color" to be used unconditionally during
generation.
2015-02-05 16:44:56 -05:00
Stephen Kelly 3f3db74413 cmMakefile: Remove ExpandSourceListArguments. 2015-02-05 20:44:25 +01:00
Stephen Kelly bd990c803b Remove use of ExpandSourceListArguments.
By now, it is only an expensive copy.
2015-02-05 20:44:25 +01:00
Stephen Kelly 5fc53f1edb cmLocalGenerator: Replace loop with find_first_not_of 2015-02-05 20:44:25 +01:00
Stephen Kelly 421eadb45b Remove use of cmsys_stl.
It is not needed.
2015-02-05 20:44:25 +01:00
Brad King 098160d5f2 Begin post-3.2 development 2015-02-05 09:59:04 -05:00
Brad King cb01f15170 CMake 3.2.0-rc1 version update 2015-02-05 09:55:27 -05:00
Brad King 9042c875dc Merge topic 'fix-C-standard-features'
fb3487a9 Features: Fix C90 feature detection.
6027798a Features: Allow setting standard dialect below the default.
9d767810 Features: Populate CMAKE_<LANG>_STANDARD_DEFAULT only for supported compilers.
72537e44 Features: Add dialect compile flags only if default is known.
82c9d686 AppleClang: Remove redundant UNIX condition.
2015-02-05 09:25:14 -05:00
Kitware Robot ebe1f4f896 CMake Nightly Date Stamp 2015-02-05 00:01:15 -05:00