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.
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.
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.
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.
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.
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.
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.
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.
...
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
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)
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>
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.
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.
The CMAKE_<LANG>_STANDARD_DEFAULT variable indicates whether the
compiler has any notion of standard levels and that CMake knows
about them. If no language standard levels are available, skip
all logic to attempt to add a flag for the level.
Also fail with an internal error if a bad default value is set.
The refactoring in commit v3.1.0-rc1~812^2~16 (stringapi: Pass
configuration names as strings, 2014-02-09) broke the code path in
cmLocalGenerator::GenerateInstallRules that intends to pick a default
install configuration for multi-config generators. Fix the logic to
select an empty default configuration only when using a single-config
generator whose CMAKE_BUILD_TYPE is not set.
Inspired-by: Roman Wüger <roman.wueger@gmx.at>
Reported-by: NoRulez <norulez@me.com>
When staging the package installation, if the first file in a directory
happens to be a symbolic link, make sure we create the directory before
trying to create the link.
When staging the package installation, if the first file in a directory
happens to be a symbolic link, make sure we create the directory before
trying to create the link.
In commit v3.0.0-rc1~222^2 (Makefile: Allow "gmake target1 target2 -j",
2013-12-18) we added generation of a .NOTPARALLEL rule and told the
generator it is "symbolic" because the file will never be created.
This causes ".PHONY" to be used. However, "clearmake" does not support
parsing of .PHONY specifically for .NOTPARALLEL, so simply drop it.
This should not affect the role of the .NOTPARALLEL rule for GNU make.
The "/showIncludes" flag is only available with MS C and C++ compilers,
and on compilers that "simulate" them (like Intel for Windows). Fix our
logic to choose this type only for MS tools with these languages. All
other cases need to use "deps = gcc" and define DEP_FILE in the build
rule.
Define an empty string in CMAKE_<LANG>_STANDARD_DEFAULT to mean that
the toolchain has no notion of lanuage standard levels. In this case
the <LANG>_STANDARD[_REQUIRED] properties will have no effect.
Update the RunCMake.CompileFeatures test to exclude the
LinkImplementationFeatureCycle test when there is no standard default.
It can never fail because no use of specific features will adjust the
CXX_STANDARD level required for any target since the standard levels
have no meaning in this case.
Otherwise building such projects gives:
warning APPX1901: The DefaultLanguage property is either missing from
the project file or does not have a value
ab9fa54d Xcode: Switch to internal CMAKE_MAKE_PROGRAM lookup by generator (#15324)
11e2e6ca Xcode: Select make program at build time
e4055a61 Xcode: Add internal API to find xcodebuild
The "cmakexbuild" wrapper is not needed for Xcode 4 and above, and the
path to it may change when CMake moves. Avoid storing a specific path
to a build program in CMakeCache.txt and instead compute the value for
CMAKE_MAKE_PROGRAM on demand. However, if a user does set the value
explicitly then honor it.
This does for Xcode what commit v3.0.0-rc1~260^2~4 (VS: Switch to
internal CMAKE_MAKE_PROGRAM lookup by generators, 2013-11-15) did for
Visual Studio generators.
Extend the change made in commit v3.0.0-rc1~260^2~16 (Teach
GenerateBuildCommand to find its own make program, 2013-11-13) to have
the Xcode generator pick between "xcodebuild" and CMake's own copy of
"cmakexbuild" at build time based on the version of Xcode.
Teach the Xcode generator to compute the location of this tool or the
cmakexbuild wrapper. Add internal APIs to get the locations on demand.
Use the "cmakexbuild" wrapper for Xcode < 4, and "xcodebuild" for modern
Xcode.
The "No rule to make target" error message of gmake is not correctly
recognized since GNU make changed the quoting style in commit 23c2b99e9d
(Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines,
2012-03-04). Fix our regex to match both old and new quoting styles.
Custom command path normalization added in commit v3.1.0-rc1~471^2
(add_custom_command: Normalize OUTPUT and DEPENDS paths, 2014-05-28)
broke use of OBJECT_DEPENDS to bring in custom commands because the
latter paths were not normalized too. Normalize them and add a test
case.
Reported-by: Daniel v. Gerpen
8ced6375 cmake-gui: Shrink spacing between search field and checkbox.
b46a1519 cmake-gui: Change install buttons to activate on clicked instead of pressed.
c19539c5 cmake-gui: Fix install menu to be available for Qt5 builds on OS X.
This will make them use the 'console' pool with the Ninja generator.
Impacted targets are:
- Built-in targets: install, install/local, install/strip, tests,
package, package_source, rebuild_cache
- Targets provided by the CTestTargets module: Nightly, Continuous,
Experimental,
and all their variants (*Start, *Configure, ...)
Read file names from the lines of a specified file. Reject input lines
starting in '-' to leave room for option parsing to be added later. Add
just '--add-file=' now to allow files starting in '-' to be specified.
d0adcccb try_run: Add tests for LINK_LIBRARIES with mock libraries.
223c5cb7 try_run: Add test for bad link libraries.
e2b1f058 try_run: Add support for LINK_LIBRARIES option.
Most functionality is already implemented in Source/cmCoreTryCompile.{h,cxx}.
Document and improve argument parsing.
This functionality is already being used by a number of modules, like
CheckCSourceCompiles.cmake, but it is not documented.
This message has been on stderr since the "-C" option was first added,
but it is informational and not an error. Other informational messages
go to stdout, so send this one there too.
When choosing whether to use a response file, consider several possible
command line length limits for the current operating system, and choose
the smallest.
When using system curl, we trust it to be configured with desired CA
certs. When using our own build of curl, we use os-configured CA certs
on Windows and OS X. On other systems, try to achieve this by searching
for common CA cert locations. According to a brief investigation, the
curl packages on popular Linux distros are currently configured as:
* Arch: /etc/ssl/certs/ca-certificates.crt
* Debian with OpenSSL: /etc/ssl/certs
* Debian with GNU TLS: /etc/ssl/certs/ca-certificates.crt
* Debian with NSS: /etc/ssl/certs/ca-certificates.crt
* Fedora: /etc/pki/tls/certs/ca-bundle.crt
* Gentoo with OpenSSL: /etc/ssl/certs
* Gentoo without OpenSSL: /etc/ssl/certs/ca-certificates.crt
Teach CMake and CTest to look for these paths and use them as a CA path
or bundle when no other os-configured or user-specified CAs are
available.
f3e0b6f1 CTestCoverageCollectGCOV: Add module to run gcov
6dd980e0 ctest_submit: Make CDASH_UPLOAD mode arguments more strict
5dc33f89 ctest_submit: Add CDASH_UPLOAD mode to upload files to CDash
This adds support for the new cdash API where arbitrary files can be
uploaded to the CDash server. This CDash API communicates via json
files so the json parser jsoncpp was added to the Utilities directory.
0238d0c3 cmake: Generate an internal 'Labels.json' file next to 'Labels.txt'
bda4f0b6 jsoncpp: Add headers to help CMake include in-source jsoncpp headers
a02fbec5 jsoncpp: Drop doxygen comments that cause Clang warnings
In each internal target directory we generate a "Labels.txt" file
containing labels for that target and its sources, but it uses an
internal format. In order to make the list of labels easier to
publish, use a json format and call it "Labels.json".
Since we now use jsoncpp headers, link CMakeLib to the jsoncpp library.
Add an option to set the mtime of entries in a tarball so that one can
create a tarball with a consistent content hash (e.g. MD5) for a given
set of files regardless of their current timestamps on disk. This will
be useful for submission of tarballs to CDash, which tracks content
hashes to avoid duplication.
Inspired-by: Bill Hoffman <bill.hoffman@kitware.com>
fa889c4d cmakemain: Initialize vector content with iterators directly.
8211010c cmakemain: Use member insert in command line handling code.
b5422573 cmListCommand: Replace loop with member algorithm.
92a37f92 Convert raw loops to set member insert.
aac44e71 Convert raw loops to vector member insert.
The default target in XCode is the first one in the file.
In commit v3.1.0-rc1~286^2 (cmTarget: use a hash_map for cmTargets
typedef, 2014-06-10) the order of the targets stored in cmMakefile was
made non-deterministic instead of lexicographic. Teach the Xcode
generator to do its own sorting to restore a predictable order.
While at it, place ALL_BUILD first (as is done in VS IDE generators)
explicitly in the comparison function so that it is the default target
even if other targets sort earlier lexicographically (e.g. "AAA").
In commit v3.1.0-rc1~687^2~4 (cmTarget: Make the source files depend on
the config, 2014-02-13) an early termination case was added to the Xcode
generator. Fix handling of this case to actually abort all the
generation steps. Otherwise some of the later steps are attempted
without the preconditions normally established by earlier steps,
possibly leading to a crash.
Since commit v3.0.0-rc1~335^2~1 (eclipse: Add natures for Eclipse based
on enabled languages, 2013-08-29) CXX projects got only "ccnature", but
Eclipse itself also adds "cnature" when creating C++ projects. Fix this
by adding both for CXX projects.
65b81da4 cmVariableWatch: Use the cmDeleteAll algorithm with for_each.
30d2de9a cmGeneratorExpressionEvaluator: Replace own algorithm with cmDeleteAll.
4a6e795b Use the cmDeleteAll algorithm instead of trivial raw loops.
abb4a678 Add a generic algorithm for deleting items in a container.
The sweeping pattern change in commit 238dd2fb (Use insert instead of a
loop in some cases, 2014-11-22) accidentally changed the iterator range
used on the queue in cmCTestBuildHandler::ProcessBuffer. Instead of
ending at the iterator positioned at the next newline to populate
CurrentProcessingLine, it was changed to go to the end of the queue.
This causes the line to contain newlines and possibly be cut off in the
middle of a line. Fix this regression by restoring use of the proper
end-of-line position.
Case where CPACK_CMAKE_GENERATOR value is non existent or
or contains multiple words that were not quoted was not
handled and produced a segmentation fault.
Specialize for std::map types to delete the second element from
the iterator. This is not quite general enough that it can
be used everywhere, because CMake inherits from std::map and
creates typedefs with custom comparison functors etc, which
can not use this algorithm.
Commit v3.1.0-rc1~297^2~5 (cmTarget: Drop 'head' argument from
GetSourceFiles, 2014-07-10) exposed a dormant bug in source file computation,
causing the test case to regress. After that commit, the source file
computation and caching finds an existing container of source files. Prior to
that patch, the GetSourceFiles method was called with either a null pointer
for the head cmTarget, or it was called with the this pointer. The
processSources method is eventually called, which normalizes the difference
between the null pointer and the this pointer for the head target. However,
the cache key depends on the actual pre-normalized pointer. The change in
that commit caused the entry to be found in the cache where it was not before,
which resulted in incorrect behavior.
Prior to that commit, the test case also fails if the GetSourceFiles overload
taking a vector<cmSourceFile*> is changed to normalize the head target at
the beginning of the method:
cmTarget const* head = head_ ? head_ : this;
Such a construct was correctly used in other locations where similar caching
was in place, before being removed in commit v3.1.0-rc1~310^2~25 (cmTarget:
Remove 'head' argument from GetLinkInformation, 2014-06-12), but is not
neccessary anymore.
Commit v3.1.0-rc1~674^2~2 (cmTarget: Cache the cmSourceFiles in
GetSourceFiles., 2014-04-05) introduced the caching, but fails the test case
for an unrelated reason. That unrelated error was introduced in
commit v3.1.0-rc1~688^2~5 (cmTarget: Allow any generator expression in
SOURCES property., 2014-03-18) and fixed in
commit v3.1.0-rc1~561^2~1 (cmTarget: Fix listing of source files at
configure-time., 2014-04-13).
All commits which fail the test case in the testable way do so when such a
cached version of the source files is found and returned at generate
time. In the test case, the cached content is populated at configure-time
through the use of the deprecated LOCATION property with CMP0026 OLD. The
cached content is an empty container for the bar target in the test case,
because its source file 'foo.cpp.o' is not known until generate-time. That
means that no source files are available to compute the link language and
the reported error is issued.
The actual problem is that the SourceFilesMap should be cleared after
configure time by cmTarget::ClearLinkMaps. Clear it there now.
55a73e6b Use the cmJoin algorithm where possible.
8dc8d756 cmStandardIncludes: Add a join algorithm for string containers.
b5813cee cmInstallCommand: Remove unused variable.
4035ef78 cmake -E tar: error out on multiple compression formats
d811d238 cmSystemTools: use an enumeration for compression formats
df16dcfb cmake -E tar: add support for .xz files with 'J'
b0a5d393 cmake -E tar: clean up flag documentation
This commit fixes a segmentation fault I encountered when my
Coverage.xml referenced a system file, eg /usr/lib/python/foo.py.
Similar to other CMake coverage parsers, this one now ignores any
files it finds that are not located within this project's source
or binary directories.
3660d063 cmTarget: Use insert instead of std::copy.
5c28495f Help: Remove documented restriction on template use.
ac3d3829 Help: Remove documented restriction on find in conditions.
36b8de56 Help: Remove documented restriction on insert APIs.
6162c919 Use two-iterator std::set::insert where appropriate.
238dd2fb Use insert instead of a loop in some cases.
2f7ef7e3 Revert "Misc. fixes for the Oracle / Sun compiler."
4c69ec6f SolarisStudio: Use alternative standard library to build CMake.
The "." in the extension was dropped by commit v3.1.0-rc1~556^2~2
(cmSourceFile: Cache the isUiFile check, 2014-02-08) by mistake. This
caused the options to not be set.
This requires the input range to supply BidirectionalIterators, which
is not a problem for where it is currently useful to us. The alternative
would be to not invoke --last;, and instead create an output iterator
similar to std::ostream_iterator, but which puts the delimiter before
the item to output.
Case where CPACK_CMAKE_GENERATOR value is non existent or
or contains multiple words that were not quoted was not
handled and produced a segmentation fault.
When configured to use UTF-8 internally, add a UTF-8 BOM
to generated .sln files for Visual Studio to correctly
handle them.
Otherwise, some versions of Visual Studio will read them
as ANSI encoded files.
When uploading files greater 2GB a cast to 'int' overflows, leading to a
bad alloc when passed to new. Also avoid floating point arithmetic when
integer calculations will work as well.
Reported-by: Justin Borodinsky <justin.borodinsky@gmail.com>
07fc7b75 Tests: Test using objects from a language enabled in a subdirectory (#15325)
fdbfcfdf Ninja: Generate rules only for languages compiled in a target (#15325)
e2a489c7 Remove some temporary vectors for ExpandListArgument.
0f99feec cmGeneratorExpression: Remove unused header.
722f1a71 CTest: Expand a string directly into a container.
Refactoring in commit v3.1.0-rc1~688^2~2 (cmTarget: Compute languages
from object libraries on demand, 2014-03-18) taught cmTarget::GetLanguages
to (correctly) include the languages of object library sources. Previously
this was done only in cmTarget::ComputeLinkImplementationLanguages to
choose the linker language.
The Ninja generator writes out generic build rules for each language
compiled within a target using the rule variables defined in the
directory of the target. This only needs to be done for languages
actually compiled within the current target. Switch from using the
cmTarget::GetLanguages method to get the list of languages over to
using cmTarget::GetSourceFiles directly so we do not get the languages
in object libraries.
Strictly speaking this should make no difference because it is not safe
to use objects from a language not enabled in the directory containing
a target or else the link information for the language may not be
considered. However, in cases when no link information happens to be
needed for a language it was possible in CMake 3.0 and below to enable
a language only in a subdirectory providing an object library, and then
use the objects from a containing directory. The above change teaches
the Ninja generator to continue working in this case.
b189c599 Tests: Run CFBundleTest only with valid configuration
3a605693 Xcode: Call IsCFBundleOnApple to decide if bundle is being built
207b7af0 cmTarget: Use GetCFBundleDirectory within GetFullNameInternal
One piece of code has some ambiguous type deduction that seems to
resolve correctly for most compilers but not for the Oracle compiler.
Make it more explicit.
Narrow down the decision if a CFBundle is built to one place.
This is a preparation patch to add another target property
which, if set, will imply BUNDLE. Having only one function
which will have to look at both properties helps to keep code
clean.
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Also add a 'CMAKE_ANDROID_API_MIN' variable to set the property
default. Teach the VS generator to write the MIN API value into
Nsight Tegra project files.
In cmCTestMemCheckHandler::PostProcessBoundsCheckerTest return early
if the output file name is empty. We already do this in the similar
cmCTestMemCheckHandler::AppendMemTesterOutput method.
When install(EXPORT) is given an absolute destination we cannot compute
the install prefix relative to the installed export file location.
Previously we disallowed installation of targets in such exports with a
relative destination, but did not enforce this for target property
values besides the location of the main target file. This could lead to
broken installations when the EXPORT is installed to an absolute path
but usage requirements are specified relative to the install prefix.
Since an EXPORT installed to an absolute destination cannot be relocated
we can just hard-code the value of CMAKE_INSTALL_PREFIX as the base for
relative paths. This will allow absolute install(EXPORT) destinations
to work with relative destinations for targets and usage requirements.
Extend the ExportImport test with a case covering this behavior.