Create a <LANG>_COMPILER_LAUNCHER target property (initialized by a
CMAKE_<LANG>_COMPILER_LAUNCHER variable) to specify a compiler launcher
tool. This will supersede the CMAKE_<LANG>_COMPILER_ARG1 approach to
using such tools. The old approach set CMAKE_<LANG>_COMPILER to the
launcher tool while the new approach leaves this variable set to the
actual compiler.
Implement this property for Makefile and Ninja generators. It cannot be
implemented for VS or Xcode generators as the IDE build tools offer no
such hooks.
The VS >= 10 generators need to parse the .sln file from the build
directory to locate targets in subdirectories. This occurs after we
change the working directory to the build tree. If a relative directory
other than "." was given then we would change to it and also refer to
the .sln file location with it. Fix this by converting the build tree
to a full path always. This will also give a more informative error
message when the directory does not exist.
Use the KWSys Process "MergeOutput" option to give each test child
process the same pipe for both stdout and stderr. This allows natural
merging of stdout and stderr together instead of merging on arbitrary
buffered read boundaries as before.
The CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH cache variables are
supposed to be used to generate the extra paths passed to pkg-config,
but instead the CMAKE_PREFIX_PATH variable is used.
This bug was introduced by the refactor in commit v3.1.0-rc1~747^2~1.
The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN were first
merged in commit v2.8.12~322 (Merge topic 'VISIBILITY_PRESET-property',
2013-06-05) but worked only for shared libraries and executables with
exports. Prior to commit v3.0.0-rc1~581^2 (GenerateExportHeader:
Deprecate add_compiler_export_flags function., 2013-09-02) the
add_compiler_export_flags function was used to add visibility flags to
all targets.
The visibility flags are useful for sources in all target types because
they may be later linked into shared libraries or executables with
exports. Introduce policy CMP0063 to enable them for all target types
while preserving compatibility with existing projects that do not expect
this.
Enable languages only in the individual test case. Enable the test
everywhere except Visual Studio generators (which do not implement the
properties) and just set fake flags as needed to activate relevant code
paths. Drop unneeded CMAKE_SUPPRESS_REGENERATION which seems to have
been copied from an unrelated test when this test was created.
The 'ctest --launch' command must be placed before the IWYU launcher on
the compiler command line. Extend the RunCMake.IncludeWhatYouUse test
to cover this case. The Ninja generator already does it correctly.
Create a <LANG>_INCLUDE_WHAT_YOU_USE target property (initialized by a
CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE variable) to specify an IWYU command
line to be run along with the compiler.
Add an internal "cmake -E __run_iwyu" mode to wrap the compiler call.
Run a given include-what-you-use command line with the compiler options
and report a warning if it finds anything. Then run the real compiler.
Co-Author: Brad King <brad.king@kitware.com>
d7923b82 Use std::unordered_map instead of hash_map where available.
820777af Tests: Don't rely on ordering of targets in maps.
921d74d8 AutoGen: Don't iterate over a container while populating it.
61d52e6e cmListFileBacktrace: Hide the context-stack implementation detail.
a271f7f1 cmTarget: Simplify CMP0023 message loop.
f4300cd4 cmTarget: Simplify output computation.
65a42849 cmTarget: Store context in stack only if different.
9645cba3 cmListFileContext: Implement EqualityComparable.
52a8d19c cmTarget: Store only cmListFileContext for CMP0023 handling.
59ba1215 cmTarget: Remove needless iteration.
18f810a8 cmListFileContext: Sort by line before file.
e96b5d14 cmListFileContext: Implement LessThanComparable.
7eb0dfa0 cmMakefile: Use std::set::insert API to simplify CMP0054 handling.
f9785e0c cmMakefile: Simplify CMP0054 handling.
e17b5e42 cmMakefile: Add access to the top-level execution context.
1ec1bf9f if(): Test the effect of cmMakefileCall use in elseif() handling.
9b4aefad cmMakefile: Replace deques with vectors.
The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track
nested loop levels in CMake language with a stack of counters,
2014-11-18) forgot to account for scopes popped by error messages about
unclosed scopes. Teach the error handler to pop the lexical scope it
reports as unclosed. Re-order the lexical scope RAII object to be
inside the variable scope RAII object scope so that the lexical scope
is fully closed before we check assertions about variable scopes.
Extend the RunCMake.Syntax test with a case covering this.
ce167b54 cmMakefile: Handle CMP0014 before configuring the generator.
7baef756 cmLocalGenerator: Assert that there is a parent.
63255342 cmMakefile: Remove redundant variable set.
894961af cmMakefile: Use the state to determine the parent directory.
115e9199 Use new top-level check abstraction.
c5059c90 cmLocalGenerator: Add abstraction to check if top-level.
b17686d2 cmGlobalGenerator: Move some flags from cmLocalGenerator.
ed41a8e7 cmLocalGenerator: Port loops to cmState::Snapshot.
48a9e91b cmState: Add an accessor for Parent snapshot and a validity check.
e7f7c2e2 cmLocalGenerator: Convert two recursive methods to loops.
c5cb3a73 cmLocalGenerator: Get project directories from the cmState.
76b59831 cmLocalGenerator: Initialize state before creating cmMakefile.
34c9ee2e cmLocalGenerator: Require a global generator in the constructor.
3837c483 Tests: Add case for 'ctest' run with bad CTestTestfile
b317b38d cmGlobalBorlandMakefileGenerator: Do not inherit from NMake generator
94867698 Don't use a cmLocalGenerator instance to call static methods.
...
Fix test cases whose behavior differs when their source or build tree is
under CMAKE_INSTALL_PREFIX by setting an install prefix under the build
tree. Otherwise they may fail when run under the default install prefix
(e.g. /usr/local).
Use the KWSys Process "MergeOutput" option to give the child process
the same pipe (or file) for both stdout and stderr. This allows
natural merging of stdout and stderr together instead of merging
on arbitrary buffered read boundaries as before.
This reverts commit 242c3966 (add_custom_command: Diagnose
MAIN_DEPENDENCY limitation, 2015-03-09) and the follow up commit
b372a99a (UseSWIG: Do not use MAIN_DEPENDENCY on custom commands,
2015-03-26).
I misdiagnosed the underlying issue that prompted creation of policy CMP0057.
The actual issue surfaces when a single custom command's MAIN_DEPENDENCY
is listed in more than one target; this issue will have to be addressed
independently.
Use file(GENERATE) to write the initial cache file so that we can
evaluate generator expressions. Use a per-config initial cache file
name in case the content varies by configuration.
6693590f Xcode: Refine quoting rules for Strings
a6331eb8 Xcode: Let PrintComment decide if the comment is non-empty
6e8952c1 Xcode: PrintComment will prepend a whitespace itself before the comment
4bd2544b Xcode: Do not add whitespace after attribute group opening brace
5cb4c838 Xcode: Properly indent PBXFileReference and PBXBuildFile
a723427b Xcode: Remove extra space in PBXProject comment
2fe8bca5 Xcode: Add comment after root object
2e0e205e Xcode: Indent using tabs
7b68c8df Xcode: Sort Xcode objects by Id
07d44d63 cmake: Remove confusing duplication.
ea819b29 cmMakefile: Remove unused method.
6ad86c7f cmMakefile: Remove bad comment.
fca2b542 cmMakefile: Internalize setting of CMakeInstance on Properties.
7bb4e3db cmMakefile: Out-of-line Home directory accessors.
6241253a cmake: Out-of-line Home and Start directory methods.
0ee3ccb3 cmake: Fix variable name bugs.
57dd094e Use vector, not list for cmCommand storage.
6deb43e6 Remove some files which do not need to be in BootstrapCommands.
ecdb1b3b Add some missing includes.
04b307b9 cmake: Simplify CommandExists method.
0f1f324b cmake: Rename oddly named variables.
275185ac cmake: Constify GetCommand method.
c57f086a cmake: Don't lower-case a string needlessly.
23368c9b cmake: Use make_pair instead of Foo::value_type.
14c70b8c cmake: out-of-line try compile state methods.
...
Port most CMakeTestBadCommandLines test cases to RunCMake.CommandLine
and drop the former test. Add validation of expected results, which was
not done by the old test.
882f48e5 Link libraries by full path even in implicit directories
318cd370 Help: Add link target for Find Modules section of cmake-developer.7
1535dcd8 Tests: Teach RunCMake to optionally merge command output to stdout
When CMP0003 was first introduced we wanted to link all libraries by
full path. However, some projects had problems on platforms where
find_library would find /usr/lib/libfoo.so when the project really
wanted to link to /usr/lib/<arch>/libfoo.so and had been working by
accident because pre-CMP0003 behavior used -lfoo to link.
We first tried to address that in commit v2.6.0~440 (Teach find_library
to avoid returning library paths in system directories, 2008-01-23) by
returning just "foo" for libraries in implicit link directories. This
caused problems for projects expecting find_library to always return a
full path. We ended up using the solution in commit v2.6.0~366 (...
switch library paths found in implicit link directories to use -l,
2008-01-31). However, the special case for libraries in implicit link
directories has also proven problematic and confusing.
Introduce policy CMP0060 to switch to linking all libraries by full path
even if they are in implicit link directories. Explain in the policy
documentation the factors that led to the original approach and now to
this approach.
Prefix test commands with the CROSSCOMPILING_EMULATOR property
for target executables. This allows test suites to be run on the host
when crosscompiling.
If the CMAKE_CROSSCOMPILING_EMULATOR variable is defined, and
CMAKE_CROSSCOMPILING is TRUE, then use CMAKE_CROSSCOMPILING_EMULATOR to run
the try_run executables. This prevents the need to populate
TryRunResults.cmake when cross compiling.
Add CROSSCOMPILING_EMULATOR target property for executables. This is used by
subsequent patches to run exectuables created for the target system when
crosscompiling. The property is initialized by the
CMAKE_CROSSCOMPILING_EMULATOR variable when defined.
Some tests may need to read "cmake --build" output passed through from
native build tools and do not know if it will be on stdout or stderr.
Optionally use the same variable for the execute_process output so
that it merges them and we can always match using expected stdout.
RPM, DEB and archive packages were not created
in cases when CPACK_<generator>_COMPONENT_INSTALL
was set to ON and a single component existed.
Patch also changes CPackRPM test to implicitly
test for this case.
Otherwise an #include directive on the first line of a source file is
ignored if the file contains a Byte-Order-Mark.
Suggested-by: Aleksey Konovalov <konovalov.aleks@gmail.com>
Add policy CMP0059 to cover this change. The property has been
deprecated since CMake 2.4 anyway.
This will help clean up cmMakefile -- the DefineFlagsOrig member should
not need to exist.
When matching ctest command-line output, we must account for the
formatting of times that take 10 seconds or more. The values are
right-justified, so use " +" to match any amount of space before them.
Revert commit v3.0.0-rc1~175^2~20 (add_dependencies: Disallow use with
INTERFACE_LIBRARY, 2013-12-25). Teach our dependency analysis to
transitively follow INTERFACE target utility dependencies as was done or
IMPORTED targets in commit v2.8.6~127^2~1 (Allow add_dependencies() on
imported targets, 2010-11-19). Extend the InterfaceLibrary test with a
case to cover header generation for a header-only INTERFACE library via
a custom target.
Extend the ``DATA{Dir/,...}`` syntax with a new ``RECURSE:`` option
to enable recursive matching of associated files. This will allow
an entire directory tree of data to be referenced at once.
bd9c7f9b Ninja: Add policy to require explicit custom command byproducts
ed8e30b0 cmGlobalNinjaGenerator: Optimize handling of known build outputs
ad094f43 cmGlobalNinjaGenerator: Fix spelling of "unknown"
82a37d3c cmGlobalNinjaGenerator: Drop unused member
Add policy CMP0058 to avoid generating 'phony' ninja rules for unknown
custom command dependencies. This requires projects to specify their
custom command byproducts explicitly. With this requirement we no
longer have to assume that unknown custom command dependencies are
generated and can instead simply assume they are source files expected
to exist when the build starts. This is particularly important in
in-source builds. It is also helpful for out-of-source builds to allow
Ninja to diagnose missing files before running custom command rules that
depend on them.
GLOB lists directories by default and GLOB_RECURSE does not.
LIST_DIRECTORIES enables user to control the behavior explicitly for
consistently for both GLOB and GLOB_RECURSE.
Implement a brand new FindMatlab module:
- Add support for versions and components.
- Find Matlab and its version in a more precise and multiplatform way.
- Add API to create a new mex extension with documentation.
- Add API to add matlab unit tests (with or without the unit test framework).
- Find as much as possible based on a single Matlab_ROOT_DIR cache entry
and allow the user to change it to re-find everything.
232a6883 Help: Add release notes for target-language-genex.
9e168941 File(GENERATE): Process genex evaluation files for each language.
b734fa44 Genex: Allow COMPILE_LANGUAGE when processing include directories.
0b945ea9 Genex: Allow COMPILE_LANGUAGE when processing compile definitions.
5c559f11 Genex: Enable use of COMPILE_LANGUAGE for compile options.
e387ce7d Genex: Add a COMPILE_LANGUAGE generator expression.
4a0128f4 VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed
Move the test cases from Tests/CMakeTests/ConfigureFileTest.cmake.in
over to use the RunCMake.configure_file infrastructure. This does much
more robust verification of CMake output for each test case, and would
have caught the regression fixed in our parent commit.
A more-specific error message is always displayed earlier in the
output if any real error occurred. This final summary message
is distracting to readers searching through the output for the
word "error". Simply drop it.
Allow URL templates to contain a %(algo:<key>) placeholder that is
replaced by mapping the canonical hash algorithm name through a map
defined by the <key>.
Extend the Module.ExternalData test to cover the behavior.
Extend the RunCMake.ExternalData test to cover error cases.
e2b9e7f7 Tests: Drop unnecessary stderr matching from RunCMake.ctest_memcheck
7ce9f6e2 Tests: Teach RunCMake to tolerate 'Error kstat returned' lines in test output
69de0f7e Tests: Teach RunCMake to tolerate Guard Malloc lines in test output
57f2aa7c Tests: Teach RunCMake to tolerate BullseyeCoverage lines in test output
b04c8ec3 Tests: Match curl error in RunCMake.ctest_submit FailDrop-* cases
1d82105e Tests: Rename RunCMake.{CTestMemcheck => ctest_memcheck}
d7662141 Tests: Rename RunCMake.{CTestSubmit => ctest_submit}
9b50388b Tests: Split RunCTest helper out of RunCMake.CTest(Submit|Memcheck)
76e7c22b Tests: Rename RunCMake.CTestMemcheck internals to match CTestSubmit
Otherwise find_library is unable to lookup the XCTest framework which
is not located in the SDK serach path:
In the 10.10 SDK the SDK frameworks are located here:
$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks
whereas the Platform SDKs are located here:
$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/Library/Frameworks
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
If a feature is added multiple times via ADD_FEATURE_INFO it should
appear only once in FEATURE_SUMMARY.
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
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.
...
The Dummy*-stderr.txt files were needed only to match platform-specific
memcheck tooling output and verify that stderr is otherwise empty. Now
that the RunCMake infrastructure knows how to strip such lines before
matching, we can simply drop these files and use the default empty
string match.
When RunCMake tests run on Solaris, the output may contain unexpected
lines of the form "Error kstat returned...". These lines are printed by
SystemInformationImplementation::RunProcess when called from
SystemInformationImplementation::ParseValueFromKStat (see issue #12066).
Until someone investigates why kstat returns values outside the range it
documents, simply remove such lines from the actual output before
matching it against the expected output.
When RunCMake tests run under Xcode Guard Malloc, Guard Malloc may add
lines of the form "<tool>(<pid>) malloc:..." to the output. Remove such
lines from the actual output before matching it against the expected
output.
When RunCMake tests run under dynamic analysis, Bullseye may add lines
of the form "BullseyeCoverage..." to the output. Remove such lines from the
actual output before matching it against the expected output.
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.
Several tests use slight variations of the same logic to enable CPack
RPM tests. Consolidate this logic into one check before any tests are
added. Look for 'rpmbuild' only on Linux and only when the test build
tree does not have spaces in the path. In particular, this will make
the result available in time for the RunCMake.CPackRPM test to be
activated even if CMake is configured exactly once.
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.
The moved tests are related to paths in INTERFACE_INCLUDE_DIRECTORIES
in general, and when exporting, and covering cases of the install
location being within the build or source prefix etc. Other build
properties containing paths should have similar tests, so this
allows some parameterization while keeping the preparation of the
various directory structures.
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.
With the Makefile generators we expect that touching or modifying the
input file of a configure_file, or removing its output, will cause CMake
to re-run on the next build. Extend the RunCMake.configure_file test
with a case covering this. Also check that CMake does not re-run if
nothing has changed.