Diagnostics which check the sanity of exported include paths
previously skipped over any path containing a generator expression.
Introduce a policy to issue an error message in such cases.
The export files created in the OLD behavior are not usable, because
they contain relative paths or paths to the source or build location
which are not suitable for use on installation. CMake will report an
error on import.
Code such as
target_include_directories(foo INTERFACE
$<INSTALL_INTERFACE:include$<FOO>>
)
should be treated as a relative directory, despite the genex, after
the INSTALL_INTERFACE is stripped away.
Previously, this would generate a relative directory on export, which
would be an error on import, so no policy is needed.
Code such as
install(TARGETS ...
INCLUDES DESTINATION $<INSTALL_INTERFACE:include>
)
should behave as if the INSTALL_INTERFACE wrapper were not present.
In code such as
install(TARGETS ...
INCLUDES DESTINATION $<FOO>include
)
the generator expressions are evaluated at generate-time. Delay
determining whether each entry is a relative path until after
the generator expressions are evaluated. Such relative paths
are based relative to the CMAKE_INSTALL_PREFIX.
Treat paths which are relative and which contain a generator
expression which is not at the beginning as relative to the
source directory.
This matches the behavior of paths which are relative but contain
no generator expression at all.
Previously this would generate a relative path with the IMPORTED
target on export(), which would be a reported as a non-existent
path on import. If used directly in the buildsystem, it would be
reported as a relative path, which is also an error. There is no
need for a policy in this case.
This variable can be useful in cross-compiling contexts where the
sysroot is read-only or where the sysroot should otherwise remain
pristine.
If the new CMAKE_STAGING_PREFIX variable is set, it is used instead
of CMAKE_INSTALL_PREFIX when generating the installation rules in
cmake_install.cmake.
This way, the CMAKE_INSTALL_PREFIX variable
always refers to the installation prefix on the target device, regardless
of whether host==target.
If any -rpath paths passed to the linker contain the CMAKE_STAGING_PREFIX,
the matching path fragments are replaced with the CMAKE_INSTALL_PREFIX.
Matching paths in the -rpath-link are not transformed.
The cross-prefix usr-move workaround is assumed not to require extension
regarding CMAKE_STAGING_PREFIX. The staging area is a single prefix, so
there is no scope for cross-prefix symlinks. The CMAKE_INSTALL_PREFIX
is still used to determine the workaround path, and that variable
remains the relevant one even if CMAKE_STAGING_PREFIX is used. If the
generated export files are deployed to the target, the workaround
will still be in place, and still be employed if required.
4cce44b Help: Document the CMAKE_MAKE_PROGRAM variable in more detail
558c74d VS: Switch to internal CMAKE_MAKE_PROGRAM lookup by generators
5229f2d Tests: Do not use an explicit make program for VS generators
72dd738 Tests: Fix MFC test heuristic for empty CMAKE_TEST_MAKEPROGRAM
fd6076d Tests: Pass CMAKE_MAKE_PROGRAM instead of --build-makeprogram
68031ab Tests: Configure SubProject-Stage2 test more robustly
003d10c Tests: Simplify VSExcludeFromDefaultBuild configuration
e47d934 Tests: Simplify VSProjectInSubdir configuration
e965cb1 Tests: Simplify CTest.BuildCommand.ProjectInSubdir configuration
72bf255 Tests: Pass --build-options to every test
4d1d772 ctest: Teach --build-options to allow zero options
96966b5 ctest: Make the --build-makeprogram optional for --build-and-test
91a0211 Simplify some calls to cmGlobalGenerator::Build
123a060 Teach GenerateBuildCommand to find its own make program
5f5c92b VS: Add internal APIs to find MSBuild, devenv/VCExpress, and msdev
4ac75fd Prefer CMAKE_MAKE_PROGRAM over CMAKE_BUILD_TOOL (#14548)
...
Teach add_custom_target to check the policy too. Extend the policy to
disallow reserved target names that we use for builtin targets like
"all".
Extend the RunCMake.CMP0037 test to cover these cases.
Pass the CMAKE_TEST_MAKEPROGRAM, if any, to each test at CMake time in
the CMAKE_MAKE_PROGRAM cache entry. Pass the CMAKE_TEST_MAKEPROGRAM
into the ExportImport, Fortran, and MacRuntimePath tests so that they
may do the same for the nested project configurations.
Now "ctest --build-and-test" can get the make program from the test
build tree cache, so drop the explicit --build-makeprogram.
Fix the condition that adds the test to check CMAKE_TEST_GENERATOR
rather than the tools used to build CMake. Drop the test on Ninja
because the generator does not support subproject generation anyway.
Stop using the general build_generator_args and pass the
--build-generator options explicitly. Also pass --build-makeprogram
explicitly when CMAKE_TEST_MAKEPROGRAM is available because there is no
CMakeCache.txt in the test project subdirectory from which to pick up
the make program.
Create a CTEST_TEST_DEVENV variable that is set to the
CMAKE_MAKE_PROGRAM used for Visual Studio 7, 8, and 9. It will always
be either "devenv" or "VCExpress", and not "MSBuild". Add the
VSExcludeFromDefaultBuild test only when this variable is set, and use
its value as the --build-makeprogram value.
More work will be needed later to restore the test on VS 10 and above
when devenv is available, but this is the simplest approach for now.
The test is only enabled on VS 10 and above, where the generators now
select for "ctest --build-and-test" the MSBuild tool by default.
Simplify the test configuration by dropping the --build-makeprogram
option and all the logic needed to compute its value. The test will
automatically use MSBuild.
Historically these were both added for the Makefile and Visual Studio
generators, respectively. Later the VS generators started using the
CMAKE_MAKE_PROGRAM cache entry to find the IDE build tool, and the
CMAKE_BUILD_TOOL was simply set as an alias.
Fix the documentation to explain that CMAKE_MAKE_PROGRAM is the modern
variable and that CMAKE_BUILD_TOOL is the compatibility alias, not the
other way around. Replace uses of CMAKE_BUILD_TOOL with
CMAKE_MAKE_PROGRAM in CMake-provided modules. Nothing needs to lookup
CMAKE_BUILD_TOOL in the cache, so simply set it as a normal variable.
Some extra options are for "ctest --build-and-test" directly, and others
are values for "--build-options". Split these two roles out into two
separate variables and update existing uses.
Use "cmake --build" to drive the "install" target from the CMake build
tree itself. This avoids using the heavier "ctest --build-and-test"
just to run the native build tool to drive installation.
Run the bootstrap script through "cmake -P" instead of
"ctest --build-and-test" so that we do not need to abuse
the --build-makeprogram option of the latter.
Re-implement the build_command() command to use "cmake --build" instead
of generating a native build tool invocation directly. This command
will internally invoke the proper native build tool.
This avoids requiring cmGlobalGenerator::GenerateBuildCommand to produce
a string so that it can be later refactored to produce a vector with no
quoting or escaping. It will also allow us to later teach CMake to
delay the decision about which build tool to invoke until after the
project build system is generated to disk. For example, on Visual
Studio 10 and above the preferred command-line tool is MSBuild, but we
need to fall back to devenv if the .sln has Intel Fortran .vfproj files.
bf755c7 set: Add unit tests for set/unset PARENT_SCOPE
bc280f1 set: Fix handling of empty value with PARENT_SCOPE
20afbd5 set: Handle value-less PARENT_SCOPE explicitly
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
Allow ExternalData_URL_TEMPLATES to be empty if a value for
ExternalData_OBJECT_STORES is provided. Assume in this use case that
the object stores will already contain all needed objects. Extend the
Module.ExternalData test to cover this case (all objects in stores).
Extend the RunCMake.ExternalData test to cover the non-failure message
case when stores are provided without URL templates.
3bade75 Help: Parse Copyright.txt instead of using current year
2bbf6bd Copyright.txt: Add test to check year range
3ee67d0 Copyright.txt: Update year range to end in 2013
621ba1f cmake-gui: Parse Copyright.txt instead of duplicating notice
993b685 bootstrap: Parse Copyright.txt instead of duplicating notice
Add a CMake.Copyright test that, when the CMake version number knows the
year (as it does in development versions), checks that Copyright.txt has
been updated with the current version year.
Split the test cases covering spaces and colons into separate units.
Run the space cases everywhere. Disable the colon cases where they
are known to fail. This approach increases platform coverage for the
test and makes the known-failure logic as local as possible.
No Makefile generator on Windows can generate targets with ':'
in their name because the CMakeFiles/<target>.dir directory cannot
be created. Skip this part of the test on all Windows Make tools.
Commit 239b0c6b (Don't add invalid content to static lib
INTERFACE_LINK_LIBRARIES., 2013-10-20) extended a test which
excercised the logic of the LINK_ONLY generator expression.
Commit ef10b87c (CMP0022: Plain target_link_libraries must populate
link interface, 2013-11-02) removed the instance of LINK_ONLY which
was excercised by that test.
Add a new test which excercises the other instance of LINK_ONLY by
setting the CMP0022 policy to NEW and consuming the contents of the
INTERFACE_LINK_LIBRARIES target property.
In commit 18412153 (Refactor cmTarget::GetCompileDefinitions...,
2013-06-06) cmQtAutomoc was refactored to get all compile definitions
from the target instead of separately asking the target and querying the
directory-level COMPILE_DEFINITIONS property value. While the
generation process does integrate directory-level COMPILE_DEFINITIONS
into the target definitions, this did not happen until after Automoc
targets are constructed. Therefore the commit regressed use of
directory-level definitions in Automoc targets.
Factor the definition finalization logic out from the
cmGlobalGenerator::CreateGeneratorTargets method into a new
cmGlobalGenerator::FinalizeTargetCompileDefinitions method and call it
before constructing Automoc targets. This will place the
directory-level definitions into the target in time to use them for the
Automoc targets.
Extend the QtAutomoc test to cover this case.
b51696f CMP0022: Update target_link_libraries plain signature documentation
25b7f87 Merge branch 'policy-CMP0022-fixes' into policy-CMP0022-fixes-for-master
0a561a0 CMP0022: Warn about a given target at most once
23d21b7 Do not export INTERFACE_LINK_LIBRARIES from non-linkable targets
ef10b87 CMP0022: Plain target_link_libraries must populate link interface
0e06788 CMP0022: Add test for target_link_libraries plain signature
c0f4a61 CMP0022: Add unit test for null pointer check and message.
4b0cfa7 Merge branch 'output-CMP0022-entries' into policy-CMP0022-fixes
Resolve conflict in Source/cmTarget.cxx by integrating the changes to
the internal copy constructor from both sides. Also resolve a logical
conflict by dropping the special case for INTERFACE_LIBRARY targets.
Since cmTarget::SetMakefile already forces CMP0022 to NEW for such
targets we need no special handling.
Resolve conflict in Source/cmTargetLinkLibrariesCommand.h by dropping
the documentation change. We will make the same change in the new
location of the same documentation in a separate commit.
Resolve conflicts in
Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt
Tests/RunCMake/CMP0022/RunCMakeTest.cmake
by taking the side from the 'policy-CMP0022-fixes' branch.
Since cmTarget::ComputeLinkInterface is called separately for each
"head" target that links a target, the warning we produce when
CMP0022 is not set could be repeated. Add explicit logic to allow
the warning to appear at most once. Multiple copies of the warning
for the same target are almost always identical and therefore
redundant. In the rare case that two copies of the warning are
different, the second can appear in a future run after the first
is fixed.
When cmExportFileGenerator::SetImportLinkInterface exports the old
LINK_INTERFACE_LIBRARIES property values it skips doing so for
non-linkable targets because target->GetLinkInterface returns NULL for
such targets.
Since cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty
looks at the INTERFACE_LINK_LIBRARIES property directly instead of using
the computed link interface, teach it to skip exporting the property if
target->IsLinkable returns false.
Extend the RunCMake.CMP0022 test with a case covering this. Simply
export an executable target that links to a library that is not
exported.
The CMP0022 NEW behavior is that the INTERFACE_LINK_LIBRARIES property
exactly defines the link interface. The plain target_link_libraries
signature says linking is transitive by default, so it should populate
the property.
Teach the target_link_libraries plain signature to populate the
INTERFACE_LINK_LIBRARIES regardless of the CMP0022 setting. Refactor
the cmTarget::ComputeLinkInterface checks that warn when the policy is
not set to compare the new property to either the explicitly set old
link interface properties or the link implementation fallback for all
linkable target types, not just static libraries.
This fixes a regression in 2.8.12.0 that caused target_link_libraries to
not implement transitive linking in the plain signature once the policy
CMP0022 is set to NEW.
Teach cmGlobalGenerator::CheckTargets to include OBJECT_LIBRARY targets
in the check for source file existence.
Extend the RunCMake.ObjectLibrary test to cover this case.
Some compilers, such as Clang on OS X, do not want the -g flag for both
generating assembly code and assembling it. Drop the -g flag from
generation of main.s in the Assembler test.
Teach the cmGeneratorExpressionEvaluator filesystem artifact logic
to reject OBJECT_LIBRARY targets since they have no main artifact.
Without the explicit rejection evaluation falls through to an
internal CMake error message in cmTarget::GetOutputInfo.
Extend the RunCMake.GeneratorExpression test to cover these cases.
b54dbeb Test foreach/function/macro handling of bracket arguments
ccdf7e0 macro: Do not substitute for placeholders in bracket arguments
999abb9 macro: Add extra indentation to placeholder substitution code
Instead of removing the depot name, which causes problems when looking
at the file change list in CDash, make the Update test remove a given
prefix from the files retrieved from Update.xml.
In certain scenarios, it is preferable to keep a 'dirty' install prefix
than to clear it, and to expect that content will not be found there.
Add a CMAKE_FIND_NO_INSTALL_PREFIX variable that can be set to disable
searching the install prefix.
Bracket arguments recorded in command invocations inside foreach,
function, and macro blocks should not have any replacements done when
the arguments are replayed later. Teach the RunCMake.Syntax test to
cover these cases.
Simply print out the lines as normal paragraph text. Teach the
CMakeLib.testRST test to cover this syntax. Update the
cmake-developer.7 manual to document support for the directives.
Add an Escape1 test case covering \-escape cases inside bracket, quoted,
and unquoted arguments. Also cover comments immediately after quoted
and unquoted arguments on lines containing \# escapes.
9c87d9c Add automatic rcc invocation for Qt.
84218e1 Add automatic uic invocation for Qt.
94a0ca6 Record which files are skipped by automoc.
18fb758 Run the main executable created in the autogen tests.
e485ba1 Rename the QtAutomoc tests to QtAutogen.
7ce65c3 Add extra checks for the AUTOMOC target property.
32771fc Update output messages for generic use.
f371ab5 Rename RunAutomoc to RunAutogen.
85b3d6e Extract an SetupAutoMocTarget method.
ca124a1 Rename the AutomocInfo.cmake file to be more generic.
a342c9f Move some makefile definitions up away from moc-specific code.
98632ef Add the AUTOGEN_TARGETS_FOLDER and obsolete AUTOMOC_TARGETS_FOLDER.
63378ba Rename some variables to reflect broader scope.
97f1aa3 Rename method to reflect generic use.
4abb111 Rename local variable to reflect generic use.
03878c9 Move variable set to where it is used.
...
3e04946 Require CMAKE_<LANG>_COMPILER to be found as a full path
6007f7c CMakeDetermineCompilerId: Always use compiler detected from IDE
332771c CMakeDetermine*Compiler: Remove temporary cache entry
All generators now support detection of the full path to the compiler, so
require it to be so. This will allow CMake<LANG>Information.cmake and
other logic to assume the full path to the compiler tool is available.
The Makefile generators already rejected CMAKE_<LANG>_COMPILER values
that did not name an existing compiler. Extend this error message to
all generators, make it occur as early as possible, and improve the
message with advice about how to set the compiler. If the full path to
the compiler is not known, finish enabling languages with a fatal error
so configuration does not continue.
For now, allow the RC language compiler to not be a full path. Later we
will need to detect the full path to "rc" under the VS IDE.
Add a RunCMake.CompilerNotFound test to cover failure cases.
Fix the RunCMake.CompilerChange test EmptyCompiler case to work
when configuration does not continue past enable_language.
ff59365 CTest: fix dashboard issues associated with the ctest-fix-run-serial topic
7a665ae CTest: added test for RUN_SERIAL issue #14484384beff CTest: added comments that describe the basic test sorting approach
adbe00d CTest: removed redundant copy of test dependency set
1b750cb CTest: perform cycle test early
6d4d7ca CTest: consider previously failed tests before all others
e809d8c CTest: prioritize tests by their depth in the dependency graph
44017a4 CTest: handle dependent and non dependent test requirements equally
ff6c401 cmTarget: Add interface for compatible numeric properties
e4e20c1 cmTarget: Add enumeration for consistency to expect from properties.
9877769 cmTarget: Assign consistent content back to the property being evaluated.
816b4a8 cmTarget: Make consistentProperty return consistent content.
030800a cmTarget: Add a template to create correct implied content.
Teach the ctest_update implementation to use the p4 command-line
client to perform updates and extract the list of changes.
Add a CTest.UpdateP4 test like those that exist already for the other
version control tools. Make the test available when p4 and the p4d
server are found. During the test launch p4d in the background to
serve a repository from the test directory. Then direct the client
toward this server for the duration of the test.
Only valid target names or generator expressions may appear in
the target field of a LINK_ONLY expression.
Other content like link flags should still be added to that property
(wrapped in config-specific generator expressions), but not wrapped
in LINK_ONLY. Otherwise undue warnings would be issued for the
policy CMP0022.
The LINK_ONLY expression only has an effect for actual target
names anyway, so there is no logical deficit.
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32. The warning appears on stderr
and breaks the expected output matching.
It was a subtest of the RunCMake.ObjectLibrary test. However, we need
to test a build with ExternalProject after running CMake, which RunCMake tests
do not do.
The source files are already processed by cmQtAutomoc to look for
moc includes, so extend that to also look for ui_ includes and
find corresponding .ui files to process.
This replaces the need to invoke qt4_wrap_ui().
As the ui files are not likely to be part of the SOURCES of the
target, store the options associated with them separately in the
cmMakefile for querying during the autogen run.
Don't try to show the windows, which would require a gui capable test
machine, and that's not guaranteed.
Automatically link to qtmain.a on Windows to avoid a policy warning. Set
policy CMP0020 to NEW by increasing the required version.
Don't attempt to run the test when using Windows.
When using the boost MPL library, one can set a define to increase
the limit of how many variadic elements should be supported. The
default for BOOST_MPL_LIMIT_VECTOR_SIZE is 20:
http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/limit-vector-size.html
If the foo library requires that to be set to 30, and the independent
bar library requires it to be set to 40, consumers of both need to set
it to 40.
add_library(foo INTERFACE)
set_property(TARGET foo PROPERTY INTERFACE_boost_mpl_vector_size 30)
set_property(TARGET foo PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX boost_mpl_vector_size)
target_compile_definitions(foo INTERFACE BOOST_MPL_LIMIT_VECTOR_SIZE=$<TARGET_PROPERTY:boost_mpl_vector_size>)
add_library(bar INTERFACE)
set_property(TARGET bar PROPERTY INTERFACE_boost_mpl_vector_size 40)
# Technically the next two lines are redundant, but as foo and bar are
# independent, they both set these interfaces.
set_property(TARGET bar PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX boost_mpl_vector_size)
target_compile_definitions(bar INTERFACE BOOST_MPL_LIMIT_VECTOR_SIZE=$<TARGET_PROPERTY:boost_mpl_vector_size>)
add_executable(user)
target_link_libraries(user foo bar)
Because the TARGET_PROPERTY reads the boost_mpl_vector_size property
from the HEAD of the dependency graph (the user target), and because
that property appears in the COMPATIBLE_INTERFACE_NUMBER_MAX of
the dependencies of the user target, the maximum value for it is
chosen for the compile definition, ie, 40.
There are also use-cases for choosing the minimum value of a number.
In Qt, deprecated API can be disabled by version. Setting the
definition QT_DISABLE_DEPRECATED_BEFORE=0 disables no deprecated
API. Setting it to 0x501000 disables API which was deprecated before
Qt 5.1 etc.
If two dependencies require the use of API which was deprecated in
different Qt versions, then COMPATIBLE_INTERFACE_NUMBER_MIN can be
used to ensure that both can compile.
When scanning CMake module files for .rst comments, recognize
bracket comments starting in ".rst:" too. For example:
#[[.rst:
Include the bracket comment content terminated by the closing bracket.
Exclude the line containing the bracket if it starts in "#".
Teach the CMakeLib.testRST test to cover multiple bracket lengths
and ending brackets on lines with and without "#".
Update the cmake-developer.7 manual to document the bracket-comment
syntax for .rst documentation.
Teach the CMake language lexer to treat the \-LF pair terminating a
line ending in an odd number of backslashes inside a quoted argument
as a continuation. Drop the pair from the returned quoted argument
token text. This will allow long lines inside quoted argument
strings to be divided across multiple lines in the source file.
It will also allow quoted argument text to start on the line after
the opening quote. For example, the code:
set(x "\
...")
sets variable "x" to the value "..." with no opening newline.
Previously an odd number of backslashes at the end of a line inside
a quoted argument would put a \-LF pair (or a \-CR pair) literally
in the argument. Then the command-argument evaluator would complain
that the \-escape sequence is invalid. Therefore this syntax is
available to use without changing behavior of valid existing code.
Teach the RunCMake.Syntax test to cover cases of quoted arguments
with lines ending in \, \\, and \\\. Odd counts are continuations.
Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to
a value lower than 2.4, and generate an error when projects or the user
attempt to do so. In the error suggest using a CMake 2.8.x release.
Teach cmake_minimum_required to warn about projects that do not require
at least CMake 2.4. They are not supported by CMake >= 3.0.
Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a
reference to policy CMP0001.
Other warnings for the same policy already have similar output since
commit 81d2793e (Add differing target property content to policy CMP0022
warning, 2013-09-11).
Add cmCommand::Disallowed helper to check the setting of a policy that
disallows the command. Add a RunCMake.DisallowedCommands test
placeholder. Add a Help/policy/DISALLOWED_COMMAND.txt file for
inclusion by each policy document to avoid duplication of the common
text.
Teach cmRST to recognize non-markup lines ending in '::' followed by a
blank line as starting a literal block. Record the whole block as if it
were a literal block directive and print it just like a code block.
Extend the CMakeLib.testRST test to cover such cases.
Move the ProcessDirectiveParsedLiteral and ProcessDirectiveCodeBlock
method internals into an OutputMarkupLines helper. Pass through it a
new "inlineMarkup" parameter and teach OutputLine to understand it.
When false, do not process inline markup. Extend the CMakeLib.testRST
test to cover the two cases.
Add a string(CONCAT) command to simply concatenate input arguments
together. This will be useful for combining strings from different
quoting syntaxes. Add a RunCMake.string test covering these cases.
Introduce a policy to control the behavior.
The AliasTargets unit test already tests that using a
double-semicolon in the name is not an error. Change the ExportImport
test to use a namespace with a double-semicolon too.
The result is that the depends of the target are created.
So,
add_library(somelib foo.cpp)
add_library(anotherlib EXCLUDE_FROM_ALL foo.cpp)
add_library(extra EXCLUDE_FROM_ALL foo.cpp)
target_link_libraries(anotherlib extra)
add_library(iface INTERFACE)
target_link_libraries(iface INTERFACE anotherlib)
Executing 'make iface' will result in the anotherlib and extra targets
being made.
Adding a regular executable to the INTERFACE of an INTERFACE_LIBRARY
will not result in the executable being built with 'make iface' because
of the logic in cmComputeTargetDepends::AddTargetDepend.
So far, this is implemented only for the Makefile generator. Other
generators will follow if this feature is possible for them.
Make INTERFACE_LIBRARY targets part of the all target by default.
Test this by building the all target and making the expected library
EXCLUDE_FROM_ALL.
daa0f6f Add Lua-style long brackets and long comments to CMake language
a8c6523 cmListFileLexer: Convert CRLF -> LF newlines explicitly
dbd9333 cmListFileLexer: Allow a leading UTF-8 Byte-Order-Mark (#11137)
5645783 cmListFileLexer: Allow command names with one letter (#14181)
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32. The warning appears on stderr
and breaks the expected output matching.
This has not been allowed since they were introduced in
commit 91438222 (target_link_libraries: Add LINK_(PUBLIC|PRIVATE)
options, 2011-10-07), but allowing this form makes it more compatible
with the newer PUBLIC and PRIVATE keywords.
Teach the CMake language parser to recognize Lua-style "long bracket"
arguments. These start with two '[' separated by zero or more '='
characters e.g. "[[" or "[=[" or "[==[". They end with two ']'
separated by the same number of '=' as the opening bracket. There is no
nesting of brackets of the same level (number of '='). No escapes,
variable expansion, or other processing is performed on the content
between such brackets so they always represent exactly one argument.
Also teach CMake to parse and ignore "long comment" syntax. A long
comment starts with "#" immediately followed by an opening long bracket.
It ends at the matching close long bracket.
Teach the RunCMake.Syntax test to cover long bracket and long comment
cases.
Read input files in binary mode instead of text mode and convert CRLF
newlines to LF newlines explicitly in our own buffer. This is necessary
to read CMake source files with CRLF newlines on platforms whose C
runtime libraries do not transform newlines in text mode. For example,
a Cygwin or Linux binary may not transform CRLF -> LF in files read from
a Windows filesystem. Perform the conversion ourselves to ensure that
multi-line string literals in CMake source files have LF newlines
everywhere.
Teach the lexer to read a UTF-8, UTF-16 BE/LE, or UTF-32 BE/LE
Byte-Order-Mark from the start of a file if any is present. Report an
error on files using UTF-16 or UTF-32 and accept a UTF-8 or missing BOM.
Teach the lexer to treat a single letter as an identifier instead of an
unquoted argument. Outside of a command invocation, the parser treats
an identifier as a command name and an unquoted argument as an error.
Inside of a command invocation, the parser treats an identifier as an
unquoted argument. Therefore this change to the lexer will make what
was previously an error case work with no other behavioral change.
Create a cmRST class to perform just enough reStructuredText processing
to support display of Help documents in human-readable text format.
This will be used to implement --help-* command-line options.
Support directives "include", "replace", "parsed-literal", "toctree"
(Sphinx), and "cmake-module" (CMake Sphinx Extension to scan .cmake
modules). Support inline CMake Sphinx Domain roles to convert
cross-references to corresponding title text. Support inline
substitutions defined by the "replace" directive, but keep it simple by
requiring replacements to be defined before use.
Add a CMakeLib "testRST" case to cover processing of supported
constructs and compare results against expected output.
With our modern development workflow it is less likely a property will
be added to C++ code without documentation. This mode only existed to
support the DocTest which had very limited coverage of the properties
anyway.
a4263c9 export(): Handle multiple dependent export sets.
66b290e export(): Process the export() command at generate time.
5fe5c32 export(): Set a Makefile on the cmExportBuildFileGenerator.
e383555 cmExportInstallFileGenerator: Fix comment to match reality.
This allows the use of the $<TARGET_FILE:...> generator expression as a
replacement for the use of the LOCATION target property. The use of the
LOCATION target property is now deprecated for in-build targets.
Also drop other checks for older CMake versions:
* Simplify cmake_set_target_folder macro.
* Use find_package(LibArchive) unconditionally.
* Simplify condition for running testVisualStudioSlnParser test.
* Convert two macros to functions.
* Unconditionally run the CTestTestRerunFailed test.
The final location and name of a build-target is not determined
until generate-time. However, reading the LOCATION property from
a target is currently allowed at configure time. Apart from creating
possibly-erroneous results, this has an impact on the implementation
of cmake itself, and prevents some major cleanups from being made.
Disallow reading LOCATION from build-targets with a policy. Port some
existing uses of it in CMake itself to use the TARGET_FILE generator
expression.
Make the API for adding targets string based so that it can easily
use cmGeneratorTarget.
Teach the cmIncludeCommand to generate the exported file at
configure-time instead if it is to be include()d.
The RunCMake.ExportWithoutLanguage test now needs a dummy header.h
file as expected error from export() is now reported after the
missing file error.
f973737 GenerateExportHeader: Port to use message(DEPRECATION)
f69606d Qt4Macros: Port to use message(DEPRECATION)
509c142 message: Add a DEPRECATION mode
7efef02 FindGTK2: Add tests for components and targets in gtk and gtkmm modules
95fc47a FindGTK2: Make pangocairo and cairo optional dependencies
26f790f FindGTK2: Change extra includes -> optional
24e0272 FindGTK2: do not skip target creation if optional dependencies are not found
d5f130c FindGTK2: Refactor _GTK2_ADJUST_LIB_VARS into _GTK2_ADD_TARGET
fffbd72 FindGTK2: Do not add freetype includes if they are not found
b69720d FindGTK2: Add libraries to the GTK2_LIBRARIES variable only when found
425ec40 FindGTK2: Do not link libfreetype
e9f46df FindGTK2: Add config directories only if different from include ones
56a79e1 FindGTK2: Set INTERFACE_COMPILE_DEFINITIONS target property only if not empty
4b47586 FindGTK2: Add check to ensure that target exists
61242cc FindGTK2: Fix gmodule, glibmm, pangoft2, and pangoxft targets
4b876de FindGTK2: Link freetype libs to targets including freetype includes
67e761f FindGTK2: Small cleanup
682eea3 FindGTK2: Do not require the GTK_ prefix in all the internal functions
0bc3763 FindGTK2: Better handling of include directories
...
54ef2be Haiku: Include files cleanup in cmCTest
38d5555 Haiku: Remove outdated preprocessor checks
1dc61f8 Haiku: Remove use of B_COMMON_DIRECTORY
7ebc1cb Haiku: Several fixes to platform module
1763c31 Set policy CMP0025 to NEW while building CMake itself
aa53ee5 Add policy CMP0025 for Apple Clang compiler id compatibility
ab65862 Clang: Add separate "AppleClang" compiler id
Drop the HELP_XCODE workarounds needed on older Xcode versions when
using Xcode >= 5. We now expect builds and rebuilds to work using
proper dependencies with no special help.
By default, the message is not issued. If CMAKE_ERROR_DEPRECATED
is on, the message is fatal. If CMAKE_WARN_DEPRECATED is on, the
message is a warning.
* Do not define BEOS anymore (this includes workarounds which we don't
need most of the time in Haiku, so we prefer opt-in IF(HAIKU) in the
cmake files instead).
* On the other hand, do define UNIX (we are trying to be compliant) and
HAIKU (there is still a number of things we don't do like the
average UNIX clone)
* Do not use UnixPaths, as our filesystem hierarchy isn't anything like
what it expects.
* Do not use -nostart, which the compiler doesn't know about anymore.
This used to be an Haiku extension to gcc, and is equivalent to
-shared which is the default gcc option.
* While "dl" functions are provided in libroot, this is always
implicitly linked so there is no need to tell cmake about it.
* Forcing position-independent code is not needed, so remove it.
* On the other hand, include appropriate linker options for executables
and shared libraries.
* Support for the two available compilers in Haiku (gcc2 and gcc4) and
pick the right headers and libraries according to the currently
selected one.
* With the adoption of the package manager, the directory layout was
changed. Tell cmake where to look for header files and libraries.
* As we don't define BEOS anymore, enable the workaround we still need
for HAIKU as well. This is the lack of a libm (it is part of the
implicitly linked in libroot)
Applied-by: Rolf Eike Beer <eike@sf-mail.de>
Previously if headers required to check if a struct has a member can be
compiled with C++ compiler only, the check would fail because the C
compiler fails. As a consequence, the result variable would be set to
false, even if the struct has that particular member.
Teach CHECK_STRUCT_HAS_MEMBER to accept a new optional argument LANGUAGE
that allows one to explicitly set the compiler to use. The new
signature is therefore:
CHECK_STRUCT_HAS_MEMBER (<struct> <member> <header> <variable>
[LANGUAGE <language>])
This assumes that coverage.py has been run in such a way to produce its
standard XML output. This uses the Cobertura schema and should be somewhat
generalizable.
Add a new command line argument to ctest. This allows users to
rerun tests that failed during the previous call to ctest. This
is accomplished by analyzing the most recently modified file named
"^LastTestsFailed*" in the Testing/Temporary subdirectory of the
project's binary directory.
Add an unset() command option to remove a variable from the calling
scope, just like the set() command's PARENT_SCOPE option. Teach the
Unset test to cover such cases.
CMake is aware of the policy's NEW behavior and the AppleClang compiler
id. Set the policy to NEW explicitly to avoid the warning and get the
NEW behavior.
Also teach the RunCMake test infrastructure to build tests with
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW to avoid the policy warning
in test output that must match specific regular expressions.
Apple distributes their own Clang build with their own version numbers
that differ from upstream Clang. Use the __apple_build_version__ symbol
to identify the Apple Clang compiler and report the Apple Build Version
as the fourth version component in CMAKE_<LANG>_COMPILER_VERSION. Add
Compiler/AppleClang-<lang> and Platform/Darwin-AppleClang-<lang> modules
that simply include the upstream equivalents.
Fix comparisons of CMAKE_<LANG>_COMPILER_ID to Clang in CMake's own
source and tests to account for AppleClang.
Currently, export() is executed at configure-time.
One problem with this is that certain exported properties like
the link interface may not be complete at the point the export() is
encountered leading to an incorrect or incomplete exported
representation. Additionally, the generated IMPORTED_LOCATION
property may even be incorrect if commands following the export()
have an effect on it.
Another problem is that it requires the C++ implementation of cmake
to be capable of computing the exported information at configure time.
This is a limitation on the cleanup and maintenance of the code. At
some point in the future, this limitation will be dropped and more
implementation will be moved from cmTarget to cmGeneratorTarget.
This target type only contains INTERFACE_* properties, so it can be
used as a structural node. The target-specific commands enforce
that they may only be used with the INTERFACE keyword when used
with INTERFACE_LIBRARY targets. The old-style target properties
matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for
this target type.
The name of the INTERFACE_LIBRARY must match a validity generator
expression. The validity is similar to that of an ALIAS target,
but with the additional restriction that it may not contain
double colons. Double colons will carry the meaning of IMPORTED
or ALIAS targets in CMake 2.8.13.
An ALIAS target may be created for an INTERFACE library.
At this point it can not be exported and does not appear in the
buildsystem and project files are not created for them. That may
be added as a feature in a later commit.
The generators need some changes to handle the INTERFACE_LIBRARY
targets returned by cmComputeLinkInterface::GetItems. The Ninja
generator does not use that API, so it doesn't require changes
related to that.
6a47c37 add_test: Mention generator expressions in old-style add_test docs
d331292 cmTestGenerator: Evaluate generator expressions in test properties
6fe5c4a cmTestGenerator: Separate test properties for each configuration
Re-insert the semicolon which was removed during splitting.
Commit d777b8e7 (Genex: Allow relative paths in INSTALL_INTERFACE.,
2013-07-25) introduced the prefixItems method to allow relative paths
in the argument of the INSTALL_INTERFACE expression. That method was
buggy in that it did not re-introduce the semicolon separator in
the result.
This bug also affects paths which are already absolute in user code.
The lack of Qt4 on a system should silently skip the corresponding tests
with no other messages. This is already the case for other find_package
calls in Tests/CMakeLists.txt.
Xcode 5.0 now relinks targets when their shared libraries dependencies
are modified, and there seems to be no way to stop it. Report this as a
known limitation in the test output and do not fail.
In Tests/Architecture and Tests/BuildDepends/Project we select a set of
OS X cpu architectures to use for the test. Prior to Xcode 4 we always
used i386 and ppc. Starting with Xcode 4, the tools do not support ppc
but do support x86_64, so we switch to that. Fix the version check to
recognize Xcode >= 5 as at least Xcode 4 and use the new architectures.
This is useful for cases like:
add_test(NAME mytest COMMAND mydriver $<TARGET_FILE:myexe>)
set_tests_properties(mytest PROPERTIES
REQUIRED_FILES "$<TARGET_FILE:myexe>"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>"
)
In this example we require the actual test executable to exist to
run the test in addition to the test driver at argv[0]. Also the
$<CONFIGURATION> expression improves over \${CTEST_CONFIGURATION_TYPE}
because the latter is not normalized for case-sensitive filesystems.
When RunCMake tests run during dynamic analysis, valgrind may add lines
of the form "==[0-9]+==..." to the output. Remove such lines from the
actual output before matching it against the expected output.
In commit 10bc50ea (Tests: ignore Guard Malloc messages in MemChecker
tests, 2013-05-13) we forgot to escape backslashes in the CMake language
to get them into the regex. Add them now.
Add the CMake.PolicyCheck test.
This test uses "git grep" to look for policies added in a "dated"
version of CMake. It will fail if a policy is added as of,
for example, CMake 2.8.11.20130828.
The intent is to prevent such constructs from making it into an
"official" release. Three instances actually appeared in the first
attempted release candidate for 2.8.12.
This test may sometimes yield false positives. After all, it's just
using a regular expression to detect this condition, and something
in a comment could possibly match it. As of right now, that's not
true, but it's easy to imagine such a comment being added.
The new test may also not catch all future problems of this sort.
However, it will catch problems of this sort for all code that follows
the present layout style in Source/cmPolicies.cxx.
The old version encountered a compile error on newer versions of GCC.
Update to the latest supported release of Trilinos, remove the version
number from the name of the Contract, and some other minor tweaks to
get the test passing once more.
This is necessary because custom commands and targets may create
custom files whose names are determined by generator expressions.
For example, clang should be using $<TARGET_FILE> and $<TARGET_FILE_DIR>
instead of reverse engineering the output file name:
http://thread.gmane.org/gmane.comp.compilers.clang.scm/80523
However, that can only be done when ADDITIONAL_MAKE_CLEAN_FILES
also accepts and evaluates generator expressions.
Similarly, KDE uses the LOCATION property where $<TARGET_FILE>
would also be better in KDE4_HANDLE_RPATH_FOR_EXECUTABLE but
also appends the result to ADDITIONAL_MAKE_CLEAN_FILES.
After this patch, both can be ported to generator expressions.
Exclude Ninja and Xcode from the CMP0021 test
They do not behave the same as the makefile generator with
relative paths.
Don't overwrite the header file for in-source builds.
Refactor generation of PASS_REGULAR_EXPRESSION for tests
CTestTestMemcheckDummyPurify
CTestTestMemcheckDummyValgrind
CTestTestMemcheckDummyValgrindPrePost
CTestTestMemcheckDummyValgrindIgnoreMemcheck
Avoid duplicating the normal ctest output matching expression. Use
literal newlines instead of "\n" to improve readability. Integrate
matching of guard-malloc lines at the end of the output with expressions
matching tool output like lines for BullseyeCoverage.
Since commit 58e52416 (Warn about arguments not separated by whitespace,
2013-02-16) we warn about arguments not separated by spaces. Loosen the
warning to not complain about left parens not separated by spaces from
the preceding token. This is common in code like "if(NOT(X))".
Teach the RunCMake.Syntax test to cover cases of left parens not
separated by spaces and check that no warning appears.
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32. The warning appears on stderr
and breaks the expected output matching.
The extendResult method expects a non-empty parameters vector, as
assured by the normal case. Avoid calling the method when the parser
finds an incomplete generator expression, but has already entered
the state of expecting to find parameters.
b93982f Merge branch 'dev/fix-variable-watch-crash' into cmake-syntax
c50f7ed cmListFileLexer: Modify flex output to avoid Borland warning
bf73264 Warn about unquoted arguments that look like long brackets
58e5241 Warn about arguments not separated by whitespace
e75b69f cmListFileCache: Convert CMake language parser to class
e945949 Add RunCMake.Syntax test cases for command invocation styles
0546484 cmListFileArgument: Generalize 'Quoted' bool to 'Delimeter' enum
28685ad cmListFileLexer: Split normal and legacy unquoted arguments
1eafa3e cmListFileLexer: Fix line number after backslash in string
f3155cd Add RunCMake.Syntax test to cover argument parsing
6aa0c21 variable_watch: Add test for watching a variable multiple times
b86e37c variable_watch: Check newValue for NULL
f9bb20f variable_watch: Don't share memory for callbacks
05dad99 variable_watch: Fix a typo in the error message
00ce12a variable_watch: Prevent making extra entries in the watch map
34b397e variable_watch: Allow specifying the data to match in RemoveWatch
e43e207 variable_watch: Match client_data when finding duplicates
0d6acb1 variable_watch: Add a deleter for the client data
fc7c3b4 variable_watch: Store client data as pointers
In the future CMake will introduce Lua-style long bracket syntax.
Warn about unquoted arguments that in the future will be treated
as opening long brackets.
Teach the RunCMake.Syntax test to cover such cases and ensure that the
warning appears.
Teach the lexer to return tokens for whitespace. Teach the parser to
tolerate the space tokens where whitespace is allowed. Also teach the
parser to diagnose and warn about cases of quoted arguments followed
immediately by another argument. This was accidentally allowed
previously, so we only warn.
Update the RunCMake.Syntax test case StringNoSpace expected stderr to
include the warnings.
If a line inside a string ends in a backslash count the following
newline character as a line increment. Add a test covering this case to
verify that subsequent line numbers are correct.
Test basic unquoted and quoted argument parsing cases including failure
on an unterminated string and an unterminated command invocation. Also
cover arguments not separated by any spaces, which is accidentally
allowed by the current parser.
The output file used for memory checker runs must be unique for every test run
in parallel, so simply make them unique for every test run. Simply use the test
index to avoid collisions.
The Borland-built CTest binary has trouble running many instances of
itself in parallel, making the test unreliable. No particular recent
change appears to be the culprit and the failure is not reliably
reproducible. Just silence the failure for now by skipping the test.
* The ALIAS name must match a validity regex.
* Executables and libraries may be aliased.
* An ALIAS acts immutable. It can not be used as the lhs
of target_link_libraries or other commands.
* An ALIAS can be used with add_custom_command, add_custom_target,
and add_test in the same way regular targets can.
* The target of an ALIAS can be retrieved with the ALIASED_TARGET
target property.
* An ALIAS does not appear in the generated buildsystem. It
is kept separate from cmMakefile::Targets for that reason.
* A target may have multiple aliases.
* An ALIAS target may not itself have an alias.
* An IMPORTED target may not have an alias.
* An ALIAS may not be exported or imported.
33e6e0b VS6: Add handling of CMAKE_*_LINKER_FLAGS_<CONFIG> variables
152dfda Add additonal tests for the linker flags
20ed496 Add documentation for the missing CMAKE_*_LINKER_FLAGS_* variables
54f7019 Add CMAKE_STATIC_LINKER_FLAGS to CMakeCommonLanguageInclude
2a43c30 Add support for CMAKE_STATIC_LINKER_FLAGS
14bbf83 Unify the way the flags of a static library are read
The VS 6 IDE does not want to recompile a particular source after
a particular header it includes is modified, even by hand. For
now just silence the failure and document it with a comment.
The new feature of install(TARGETS ... INCLUDES DESTINATION) introduced
in commit 650e61f8 (Add a convenient way to add the includes install
dir to the INTERFACE., 2013-01-05) introduced this crash. If the
new feature is used with a target which has no
INTERFACE_INCLUDE_DIRECTORIES, a segfault occurred.
Commit 650e61f8 (Add a convenient way to add the includes install
dir to the INTERFACE., 2013-01-05) introduced an error case for
using the install(TARGETS) command with specified INCLUDES DESTINATION,
but no specified EXPORT set.
It is convenient to use a variable to set the various destinations
for different outputs (as KDE does), and some targets such as
executables are installed but not exported. This was triggering
the error case, but as it is a common case, remove the error.
This reverts commit 6187876dea.
It was actually possible before to have paths with spaces in them, the spaces
just need to be quoted. This way spaces will work as argument separators.
First, it prevents a NULL dereference and second it reiterates that
targets without languages are not supported by CMake.
Add a RunCMake.ExportWithoutLanguage test exporting a library without a
languages.
Teach the Preprocess test to get, set, and then get the same value for
the COMPILE_DEFINITIONS target property and verify that the value is not
changed. This ensures the internal structured storage of the property
value can reproduce the original string value.
Add a new signature to help populate INTERFACE_LINK_LIBRARIES and
LINK_LIBRARIES cleanly in a single call. Add policy CMP0023 to control
whether the keyword signatures can be mixed with uses of the plain
signatures on the same target.
Export the INCLUDES DESTINATION without appending to the
INTERFACE_INCLUDE_DIRECTORIES of the target itself. That way, a target
can be exported multiple times with different INCLUDES DESTINATION
without unintended cross-pollution of export sets.
It accepted an optional argument to test for equality, but no way
to get the linker language of a particular target.
TARGET_PROPERTY provides this flexibility and STREQUAL provides
the necessary API for equality test.
Extend the CompileDefinitions test to cover accessing the
property of another target.
bf23891 CPackWIX: Add support for custom WiX templates
155bb01 CMakeCPack: Provide an upgrade guid for WiX
bfa2e29 CPackWIX: Add option to specify the language(s) of the installer
6e51ea9 CPackWIX: Handle multiple shortcuts in the start menu
6d77e1a CPackWIX: Fix MSI package layout regression from parent
8c0e325 CPackWIX: Handle CPACK_PACKAGE_EXECUTABLES (#13967)
If one of the libraries (_DEBUG or _RELEASE) is not set, the value is
set to the value of the other one. FindQt4, from which the macro is
extracted, sets the values to XXX_LIBRARY_{DEBUG,RELEASE}-NOTFOUND
instead. In both cases the XXX_LIBRARY is correct, but using NOTFOUND
makes it easier to understand which one is missing.
Update Tests/CMakeOnly/SelectLibraryConfigurations with the new logic.
In CMakeDetermineCompilerABI we use try_compile with the COPY_FILE
option to get a copy of the compiled binary used to detect the ABI
information. We already tolerate the case when compilation fails.
However, when compilation appears to succeed but does not produce the
expected executable the try_compile command immediately reports an error
because the COPY_FILE fails.
Tolerate COPY_FILE failure without stopping the overall configuration
process by using the try_compile COPY_FILE_ERROR option to capture the
error message. Log the full error to CMakeError.log and simply report
failure to detect the ABI as if compilation had failed.
Teach the RunCMake.Configure test to cover this case and verify that the
messages show up as expected both in stdout and in CMakeError.log.
The test uses generate_export_header(cmp0022OLD ...) to generate the
cmp0022_export.h header used by both cmp0022OLD and cmp0022NEW. In
the latter the _EXPORTS symbol does not match what the header expects
so the library does not export anything. The Watcom linker does not
like to create shared libraries that do not export any symbols.
Fix this by setting the DEFINE_SYMBOL property on cmp0022NEW to match
that of cmp0022OLD as the header expects.
9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
1925cff Add a SYSTEM parameter to target_include_directories (#14180)
286f227 Extend the cmTargetPropCommandBase interface property handling.
83498d4 Store system include directories in the cmTarget.
f1fcbe3 Add Target API to determine if an include is a system include.
2679a34 Remove unused variable.
Unlike other target properties, this does not have a corresponding
non-INTERFACE variant.
This allows propagation of system attribute on include directories
from link dependents.
3e30d9e TLL: Don't populate old link interface if CMP0022 is NEW.
574fec9 Export: Generate INTERFACE_LINK_LIBRARIES property on targets.
d0a76ea Introduce the INTERFACE_LINK_LIBRARIES property.
ddde61c Introduce the LINK_ONLY generator expression.
5aa9731 GenexEval: Add abstracted access to link interface for a target.