Use preprocessor loops and add a unit test for the appropriate
policies. All policies whose value is recorded at target creation
time should be part of this list.
When CMake reports failure to configure a project, especially when the
toolchain does not initialize properly, the true reason may be clear
from reading the CMakeFiles/CMake(Output|Error).log files. Advise users
to look at these files if they exist when configuration fails.
Add RunCMake.Configure test to check that the log files are mentioned
when configuration fails.
We have two mappings for the "/MAP" flag. The first does not care
whether there is a value and activates the GenerateMapFile boolean
setting. The second takes a value and puts it in the MapFileName
setting. The latter must treat the ":" as part of the flag.
This is similar to commit 8ae66bf4 (Fix optionally-valued booleans in VS
10 flag table, 2009-10-23).
The wording "Commands in the file are processed immediately as if they
were written in place of the include command" sounds as if some kind of
macro replacement is performed. This is not accurate. Update the
wording to describe behavior of the included code in terms of the
variable access scope.
Always populate the INTERFACE_LINK_LIBRARIES for interface
entries. Don't populate the old interface properties
matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?
if CMP0022 is NEW.
Because the INTERFACE_LINK_LIBRARIES property is now populated by
the target_link_libraries when operating on a static library,
make an equivalent change which populates the property with
the same value when the old link_libraries() command is used. This
silences the policy warning in that case.
This property is generated only for targets which have recorded
policy CMP0022 as NEW, and a compatibility mode is added to
additionally export the old interfaces in that case too.
If the old interfaces are not exported, the generated export files
require CMake 2.8.12. Because the unit tests use a version which
is not yet called 2.8.12, temporarily require a lower version.
This property replaces the properties which
match (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?, and is enabled
for IMPORTED targets, and for non-IMPORTED targets only with a policy.
For static libraries, the INTERFACE_LINK_LIBRARIES property is
also used as the source of transitive usage requirements content.
Static libraries still require users to link to all entries in
their LINK_LIBRARIES, but usage requirements such as INCLUDE_DIRECTORIES
COMPILE_DEFINITIONS and COMPILE_OPTIONS can be restricted to only
certain interface libraries.
Because the INTERFACE_LINK_LIBRARIES property is populated unconditionally,
we need to compare the evaluated result of it with the link implementation
to determine whether to issue the policy warning for static libraries. For
shared libraries, the policy warning is issued if the contents of
the INTERFACE_LINK_LIBRARIES property differs from the contents of the
relevant config-specific old LINK_INTERFACE_LIBRARIES property.
CMake requires the top-level CMakeLists.txt to contain a direct call to
the project() command and will insert one if there is not. Document
this requirement since some authors have tried to use include() to load
a file calling the project command.
This was missing from commit 30962029 (Make targets depend on the
link interface of their dependees., 2012-12-26), which caused
only immeditate entries of the link interface to become target
depends.
Entries from the cmMakefile are processed and maintained similarly
to other include directories. The include_directories(SYSTEM)
signature affects all following targets, and all prior targets
in the same makefile.
Add to the brief documentation of the Visual Studio 10, 11, and 12
generators the corresponding VS product year. Clarify that VS11 is for
Visual Studio 2012, and VS12 is for Visual Studio 2013.
9a76d83 VS12: Find proper MSBuild for VSProjectInSubdir test
4e5cb39 Merge branch 'master' into vs12-generator
78fdbbc FindBoost: Add -vc120 mangling for VS 12
e99d7b1 VS12: Generate flag tables from MSBuild v120 tool files
77ac9b8 VS12: Add Visual Studio 12 generator (#14251)
539356f Ninja: Custom Command file depends don't need to exist before building
874e171 Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non static
88d27ad Add a test to expose a bug with add_custom_command and ninja.
When converting custom commands for the ninja build system we
need to make sure that any file dependencies that exist in the build
tree are converted to phony targets. This tells ninja that these
files might not exist when starting the build, but could be generated
during the build.
This is done by tracking all dependencies for custom command targets.
After all have been written out we remove all items from the set
that have been seen as a target, custom command output, an alias,
or a file in the source directory. Anything that is left is considered
to be a file that will be generated as a side effect of another
custom command.
To properly track the usage of dependencies that are generated at
compile time as the side effect of other build steps we need
to make the WriteBuild and WritePhonyBuild commands non static
Run cmparseMSBuildXML.py on cl.xml, lib.xml, and link.xml to generate
our flag tables:
python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/v120/1033/cl.xml" > cmVS12CLFlagTable.h
python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/v120/1033/lib.xml" > cmVS12LibFlagTable.h
python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/v120/1033/link.xml" > cmVS12LinkFlagTable.h
Fix up the declaration names at the top of each file. Finally, teach
cmVisualStudio10TargetGenerator to select the version of the table
matching the version of VS.
Copy cmGlobalVisualStudio11Generator to cmGlobalVisualStudio12Generator
and update version numbers accordingly. Add the VS12 enumeration value.
Add module CMakeVS12FindMake to find MSBuild. Look for MSBuild in its
now-dedicated Windows Registry entry. Teach the platform module
Windows-MSVC to set MSVC12 and document the variable. Teach module
InstallRequiredSystemLibraries to look for the VS 12 runtime libraries.
Teach tests CheckCompilerRelatedVariables, Preprocess, VSExternalInclude,
and RunCMake.GeneratorToolset to treat VS 12 as they do VS 10 and 11.
Inspired-by: Minmin Gong <minmin.gong@gmail.com>
In each .l and .y input file that has instructions for manual
transformation of the output to include a step to remove the 'register'
storage specifier.
This has been requested, along with a patch, by Shaun Williams
in http://public.kitware.com/Bug/view.php?id=13788 .
It adds a global property AUTOMOC_TARGETS_FOLDER, which can
be used to group the automoc targets together in a folder e.g.
in Visual Studio.
Alex
In my project group we are using CMake to generate c++/cli winform
projects and I noticed the work done in commit 79ec7868 (VS: Add Windows
Forms Support, 2013-04-29) was in the right direction for solving some
of the problems we were facing.
The changes as submitted was breaking some functionality in our
projects, so I made some changes that fixes our problems and I believe
that it will also work for others.
* Resx files did not link correctly with the winform h-file so I added
the Resx configuration to the vcxproj file.
* I removed the functionality for setting <CLRSupport> true for the
project based on if an resx-file is pressent. This is preventing
us from using native cpp code. Also this do not address that some
projects will need to set other options like clr:pure, clr:safe.
This could be implemented as a cmake option, so it is possible to
specify exactly what is needed. Existing VSWindowsFormsResx Test
project is updated so it will be working with my changes.
d221eac Refactor target COMPILE_OPTIONS and COMPILE_FLAGS handling
b6385ca Escape target flags taken from COMPILE_OPTIONS
0c9cc9a Embarcadero: Use response files only for includes, objects, and libs
Replace the cmLocalGenerator GetCompileOptions method with an
AddCompileOptions method since all call sites of the former simply
append the result to a flags string anyway.
Add a "lang" argument to AddCompileOptions and move the
CMAKE_<LANG>_FLAGS_REGEX filter into it. Move the call sites in each
generator to a location that has both the language and configuration
available. In the Makefile generator this also moves the flags from
build.make to flags.make where they belong.
Factor appending of individual flags out into an AppendFlagEscape method
in cmLocalGenerator and teach it to use EscapeForShell. Update all
COMPILE_OPTIONS handling to use AppendFlagEscape.
Override the method in the Xcode generator to use its custom escape
implementation.
Teach the CompileOptions test to add an option that requires escaping
everywhere instead of just with the GNU tools.
While calculating dependencies collapse sequences such as
../../../a/b/c/../../d/e/../../e/f
to avoid total path lengths over the Windows path length limit as much
as possible.
ff015ee Genex: Report error if a target file is needed to evaluate link libraries.
b58aff9 Genex: Extend EvaluatingLinkLibraries to also check the top target name.
b1c19ce Genex: Make LINK_LANGUAGE report an error when evaluating link libraries.
0e1cb07 Add missing return after error report.
Currently when a configured file is removed from the build directory,
running the build command will not regenerate the file. Now detect
this and will rerun cmake properly when a user issues the build
command.
AddCMakeDependFile and AddCMakeOutputFile both store as std::string
and all calling sites use std::string. So instead of creating more
temporary objects, lets just use std::strings.
Through use of libarchive internally we support .zip files as well as
.tar format. The ExternalProject module makes use of this feature.
Document support officially.
Expose the internal system information API to the CMake language. For
example, it is useful to see how much memory the system has available to
estimate an upper limit of tests that can run in parallel.
Each call to AddDefinition has overhead for variable watches and such.
Avoid extra calls when not needed.
This decreases the configure time for ParaView by 10 seconds on my
machine. Without the change about 1,000,000 set-to-empty calls were
being made. After the change it drops to about 100,000.
The SHA512_Update implementation accesses input data via 64-bit
integers. This requires alignment of the input buffer on some
architectures. Align our stack-allocated buffer for file content to
satisfy this requirement.
Describe explicitly the scope in which enable_language must be
invoked to handle all direct and indirect uses of a language.
While at it, re-word documentation of the OPTIONAL keyword to
avoid confusion over its partial implementation.
For clang, this allows passing -target <triple> to the compiler, and
for qcc, -V<arch> using toolchain files containing something like
set(triple arm-linux-gnueabihf)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_CXX_COMPILER_TARGET ${triple})
or
set(arch gcc_ntoarmv7le)
set(CMAKE_C_COMPILER /opt/qnx650/host/linux/x86/usr/bin/qcc)
set(CMAKE_C_COMPILER_TARGET ${arch})
set(CMAKE_CXX_COMPILER /opt/qnx650/host/linux/x86/usr/bin/QCC)
set(CMAKE_CXX_COMPILER_TARGET ${arch})
Both clang and qcc are inherently cross compiler( driver)s.
Commit 089fe1c1 (Optimize genex evaluation for includes and
defines., 2013-02-01) introduced an optimization on DAG processing
to not reprocess properties on targets which have already been seen.
This was refactored slightly in commit 8dfdf1c7 (Fix the tests for
evaluating includes and defines., 2013-02-18), but was not extended
to cover COMPILE_OPTIONS in commit 80ca9c4b (Add COMPILE_OPTIONS target
property., 2013-05-16).
This omission causes the same performance regression in running
cmake on LLVM which 089fe1c1 fixed before, but this time for the
transitive evaluation of the COMPILE_OPTIONS property.
As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is
introduced, which is never a list.
The contents of this variable is passed to supporting compilers
as --sysroot. It is also accounted for when processing implicit
link directories reported by the compiler, and when generating
RPATH information.
Extend the signature
try_compile(RESULT_VAR <bindir> <srcfile> ...)
to allow multiple sources as
try_compile(RESULT_VAR <bindir> SOURCES <srcfile>... ...)
Process the sources to generate a CMakeLists.txt that enables all needed
languages.
Teach the TryCompile test to try cases with two sources of the same
language and of mixed languages. Teach RunCMake.try_compile to cover
error cases for the signature.
If the expression $<TARGET_PROPERTY:prop> appears in the content
of a target property, the target that prop is read from is
the 'head target' of the expression. In contexts such as evaluating
the content of a target property during generation, such
as INCLUDE_DIRECTORIES, the 'head target' is the one on which the
initial request was made.
If evaluating a generator expression which is not a target property
content, the target must be explicitly specified. Such contexts
include add_custom_command and file(GENERATE). The content might
then look like
$<TARGET_PROPERTY:tgt,prop>
However, as there is no HeadTarget set, any generator expressions
evaluated as part of reading prop from tgt which do not specify
the tgt directly report an error.
Modify the logic of the TARGET_PROPERTY generator expression so
that in such contexts, the 'head target' is set to the appropriate
target which was first encountered.
In commit 2bc22bda (Xcode: Add frameworks search paths from link
dependeny closure, 2012-12-07) we made framework search paths from the
link closure conditional on target type, skipping it on STATIC and
OBJECT library targets that do not actually link. However, the
framework search paths also influence the compile lines (-F options) so
we need them for all target types. The Makefile generator already does
this, as did the Xcode generator prior to the above-mentioned commit.
Fix the wording of the documentation for CMAKE_PARENT_LIST_FILE to
clarify that it only applies to the include stack in the current
directory. Specify exactly what commands can include files instead of
saying "somehow invoke".
It is common to specify a CMAKE_TOOLCHAIN_FILE and get a warning
for using it despite it not being used.
The WarnUnusedCliUnused test relies on the warning being emitted
each time cmake is run on an existing build. That behavior is changed
by this patch to warn only on the first invokation of CMake, and not
on subsequent invokations (because the variable is in the cache with
the same value). For that test, a clean target is added which clears
the cache and cause the warning to be emitted each time.
As the Ninja generator does not support the feature needed to test
this, it is not tested with that generator.
This command is similar to add_definitions, in that it affects
the compile options of all targets which follow it. The implementation
is similar to the implementation of the include_directories command,
in that it is based on populating a COMPILE_OPTIONS directory property
and using that to initialize the same property on targets.
Unlike the include_directories command however, the add_compile_options
command does not affect previously defined targets. That is, in
the following code, foo will not be compiled with -Wall, but bar
will be:
add_library(foo ...)
add_compile_options(-Wall)
add_library(bar ...)
Use makefile->IssueMessage() to print the unprocessed watch message in a
format consistent with other CMake messages and with a more complete
call stack for the access.
When a watch does not specify a command to call then variable_watch
prints out a message to stderr. Remove code after that which collects
all variable values to construct a message that is never printed.
Otherwise such code causes a READ_ACCESS watch to trigger on all
variables in the currents scope.
Reported-by: Yichao Yu <yyc1992@gmail.com>
In commit 9a5b4eba (All variable accesses should produce watch
callbacks, 2007-05-17) we added a new enumeration value but did not
update the list of strings matching them. Add the missing entry.
Without this, variable_watch prints REMOVED_ACCESS instead of
MODIFIED_ACCESS when set the value of the variable.
dc1d025 OS X: Add test for rpaths on Mac.
8576b3f OS X: Add support for @rpath in export files.
00d71bd Xcode: Add rpath support in Xcode generator.
94e7fef OS X: Add RPATH support for Mac.
RPATH support is activated on targets that have the MACOSX_RPATH
property turned on.
For install time, it is also useful to set INSTALL_RPATH to help
find dependent libraries with an @rpath in their install name.
Also adding detection of rpath conflicts when using frameworks.
This fixes bug #13797.
The kinds of changes applied in 373faae5 for frameworks are now
applied to CFBundle. The prefix and suffix for CFBundles are
now handled in cmTarget::GetFullNameInternal.
This corresponds to the g++ and clang++
option -fvisibility-inlines-hidden on linux. On Windows with MinGW,
this corresponds to -fno-keep-inline-dllexport. That option is
not supported by clang currently.
This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target
property is used as the operand to the -fvisibility= compile option
with GNU compilers and clang.
Currently it only adds the contents of the COMPILE_FLAGS target
property, but it can be extended to handle a new COMPILE_OPTIONS
generator expression enabled property.
Process all arguments in a single loop using a simple state machine.
While at it, fix some error message typos. Also allow LINK_LIBRARIES
with no actual libraries to disable use of the -DLINK_LIBRARIES=...
from the CMAKE_FLAGS. This was already possible in the old logic if
LINK_LIBRARIES was immediately followed by another keyword argument
instead of the end of the argument list, so allow it in general.
Update the RunCMake.try_compile test cases accordingly.
3aa9ce4 GenexEval: Fix evaluation of INCLUDE_DIRECTORIES target property.
0b39fef GenexEval: Extract a getLinkedTargetsContent from TargetPropertyNode.
53164ac cmTarget: Remove some hardcoding of transitive property names.