The parent commit changed the AutogensType::value_type to be
"std::pair<cmQtAutoGenerators,cmTarget const*>" but our std::make_pair
call returns "std::pair<cmQtAutoGenerators,cmTarget*>". Construct the
value_type directly instead of using make_pair. Otherwise the Sun 5.9
compiler complains
".../Source/cmGlobalGenerator.cxx", line 1281: Error:
Formal argument x of type "const std::pair<cmQtAutoGenerators, const cmTarget*>&"
in call to "std::vector<std::pair<cmQtAutoGenerators, const cmTarget*> >
::push_back(const std::pair<cmQtAutoGenerators, const cmTarget*>&)" is being
passed "std::pair<cmQtAutoGenerators, cmTarget*>".
As we're iterating over IMPORTED targets now, handle them in
the loop body. The existing behavior is harmless because generally
nothing is done anyway for IMPORTED targets in these code paths,
because they do not have sources for example.
As an INTERFACE_LIBRARY has no direct link dependencies, we can
short-circuit in cmGeneratorExpressionEvaluator and
in cmGlobalGenerator::CheckLocalGenerators.
As they do not generate any output directly, any generate- or install-
related code acn also be short-circuited. Many of the local generators
already do this.
Because only INTERFACE related properties make sense on INTERFACE_LIBRARY
targets, avoid setting other properties, for example via defaults.
15eeace cmTarget: Trivially make more API const.
be9dfb6 cmTarget: Make GetExportMacro const.
0794c13 cmTarget: Make NameResolvesToFramework const.
1c27521 cmGlobalGenerator: Make NameResolvesToFramework const.
37554ac cmMakefile: Make FindTarget const.
8841d73 cmMakefile: Make IsAlias const.
36e31cd cmTarget: Make GetInterfaceLinkLibraries const.
04d398d cmTarget: Make GetTargetSourceFileFlags const.
50d1520 cmTarget: Make custom command accessors API const.
0f87643 cmGeneratorTarget: Make GetIncludeDirectories const.
Some generators can use the any enabled languages to add extra support
in the relevant build tool. One such is Eclipse since there are many
plugins available for various languages.
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.
Code paths that look up CMAKE_MAKE_PROGRAM from the cache only to
pass it to Build, which only passes it to GenerateBuildCommand,
no longer need to do so. GenerateBuildCommand now knows how to
look up CMAKE_MAKE_PROGRAM in the cache when no explicit value
is given, so simply pass 0 now.
Add a cmGlobalGenerator::SelectMakeProgram method to select a
caller-provided make program, the CMAKE_MAKE_PROGRAM cache entry, or a
generator-provided default. Call it from all implementations of the
GenerateBuildCommand method with the corresponding generator's default,
if any.
All cmGlobalGenerator::GenerateBuildCommand call sites that need to
produce a string now generate "cmake --build" commands. The remaining
call sites immediately pass the result to cmSystemTools::RunSingleCommand.
Avoid the intermediate string and argument parsing by directly producing a
vector of strings. Also drop the ignoreErrors argument because no call
sites remain that use it.
Create a GenerateCMakeBuildCommand method to generate a command-line
string invoking "cmake --build" for a given target and configuration.
Optionally allow the "-i" make flag and additional native options.
This is a virtual method that is overridden by every generator
subclass. The base class implementation should never be called,
so replace it with a dummy implementation.
Refactor edit_cache tool selection to ask each global generator for its
preference. Teach the Ninja generator to always use cmake-gui because
Ninja by design cannot run interactive terminal dialogs like ccmake.
Teach the Makefile generator to use cmake-gui when also using an "extra"
generator whose IDE has no terminal to run ccmake, and otherwise fall
back to CMAKE_EDIT_COMMAND selection for normal Makefile build systems.
dcac9be Make accessors for compile-related information const.
19a8a3c cmTarget: Don't finalize include directories in GetIncludeDirectories.
3305364 cmGlobalGenerator: Rename the FinalizeCompileDefinitions method.
Rename cmSystemTools::FindExecutableDirectory to FindCMakeResources.
Teach it to compute the locations of cmake, ctest, cpack, ccmake, and
cmake-gui executables, and the location of CMAKE_ROOT. Provide this
information from static cmSystemTools::Get<resource>() methods.
Refactor code that needs these locations to use the new APIs.
Teach FindCMakeResources to use the OS X system API to lookup the
executable location. When running from the CMake build tree itself,
leave a file in the tree that FindCMakeResources can use to read the
location of the source tree. This avoids the need to compile the source
tree location into a binary that may be installed and used without the
source tree.
Teach the QtDialog on OS X to create a "cmake-gui" symlink in the build
tree next to "cmake" and the other tools, as is already done in the
install tree for the application bundle. This ensures a consistent set
of executables are available in one directory.
This change causes the GetLinkInterfaceDependentStringProperty method,
called in SetupAutoGenerateTarget, after the creation of generator
targets. In CMake 4.0, the GetLinkInterfaceDependentStringProperty
will move to the cmGeneratorTarget class, and this patch is a necessary
prerequisite to that.
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.
Factor member cleanup out from cmGlobalGenerator::Configure and the
destructor into a dedicated helper to avoid duplication. This fixes
clearing of BuildExportSets between configures.
In the CMake interactive dialogs cmGlobalGenerator::Configure may
run more than once. Clear the cmGlobalGenerator::EvaluationFiles
data between configures to avoid accessing deleted data.
Teach cmGlobalGenerator::CheckTargets to include OBJECT_LIBRARY targets
in the check for source file existence.
Extend the RunCMake.ObjectLibrary test to cover this case.
638843a Remove the Location member from cmTarget.
90ef1cf Move GenerateTargetManifest to cmGeneratorTarget.
25f1df3 Split CreateGeneratorTargets into two methods.
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.
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.
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.
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.
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
The parent commit introduced a separate "AppleClang" compiler id for
Apple's Clang distribution. Add a policy in order to support projects
that expect this compiler's id to be just "Clang". When the policy is
OLD or not set, map AppleClang back to Clang. Continue to use the
AppleClang id internally while enabling the language, but set the
CMAKE_<LANG>_COMPILER_ID after project() or enable_language() to the
compatible value for use by project code.
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.
Convert the incoming value to a path in the same way that the
already-cached value was converted before comparison.
Do the actual comparison only one time, after both values are
normalized.
* 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.
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.
d7dd010 Add target property debugging for COMPILE_DEFINITIONS
1841215 Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
afc9243 Add an overload of cmIDEOptions::AddDefines taking a vector of strings.
d95651e Overload cmLocalGenerator::AppendDefines to add a list.
Use constructs similar to those for COMPILE_OPTIONS. This is a little
different because there is a command to remove_definitions(), so
we can't populate the equivalent target property until generate-time
in cmGlobalGenerator.
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.
The idea is to write to a temp file which contains generator
expressions, and at generate time, evaluate the generator expressions,
and write the result to a file.
Because executables on Windows are limited in the length of command line
it is possible to use, it is common to write command line arguments to a
file instead and specify the file as a source of arguments.
This new FILE(GENERATE) subcommand allows the use of generator
expressions to create such files so that they can be used with
add_custom_command for example.
Extend the cmGlobalGenerator::GenerateBuildCommand virtual method
signature with a "projectDir" parameter specifying the top of the
project build tree for which the build command will be generated.
Populate it from call sites in cmGlobalGenerator::Build where a
fully-generated build tree should be available.
Commit 79568f95 (automoc: Add source file to target early to set the
linker language, 2013-02-20) changed automoc initialization to a two
step process. In the first step, the generated source file was added
to the target, which allows the link language to be determined.
However, this bypassed the check for the availability of Qt itself.
At build-time the automoc file could not be generated because the moc
tool was not available to create it.
The solution is to only add the automoc file to the target if Qt is
found.
Previously, GetIncludeDirectories was called before calling
target->AddSourceFile(mocCppSource). Since commit a1c4905f (Use the
link information as a source of compile definitions and
includes., 2013-02-12), the include directories are determined by
the link information.
Valid link information requires that the linker language can be
determined, which depends on the source files languages and the
dependent targets languages. In the case of the no_link_languages
target in the unit test, there are no dependencies and the additional
source file no_link_languages_automoc.cpp is added to the target
at generate-time. That file can be used to determine the linker
language, but it must be added to the target before calling
GetIncludeDirectories.
Reject the option by default. It will be implemented on a per-generator
basis. Pass the setting into try_compile project generation. Add cache
entry CMAKE_GENERATOR_TOOLSET and associated variable documentation to
hold the value persistently.
Add a RunCMake.GeneratorToolset test to cover basic "-T" option cases.
Verify that CMAKE_GENERATOR_TOOLSET is empty without -T, that -T is
rejected when the generator doesn't support it, and that two -T options
are always rejected.
6063fef Output include directories as LOG messages, not warnings.
aa66748 Specify the target whose includes are being listed.
d70204a Only output includes once after the start of 'generate-time' when debugging.
0d46e9a Store includes from the same include_directories call together.
During configure-time, GetIncludeDirectories may be called too, for example
if using the export() command. As the content can be different, it should
be output each time then.
This makes
set(CMAKE_BUILD_INTERFACE_INCLUDES ON)
add the equivalent of
set_property(TARGET tgt APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}>
)
to every target.
If the headers are in CMAKE_CURRENT_SOURCE_DIR, and the generated headers
are in CMAKE_CURRENT_BINARY_DIR, this is a convenient way to build a target
bar, which depends on foo, just by using target_link_libraries() and adding
the INTERFACE_INCLUDE_DIRECTORIES to the INCLUDE_DIRECTORIES of the target
being linked. There will be more-convenient porcelain API to consume the
property in the future.
Solution folders are supported as read-only in the VS11 Express
Edition, so do not prohibit their use just because we detect the
express edition (as we did in the VS10 generator).
Inspired-by: Paris
75ebebc VS: Remove platform specific generator files
8b62080 VS: Remove EnableLanguage from platform-specific generators
5bdf011 VS: Remove GetPlatformName from platform-specific generators
8d42ab4 VS: Fix ArchitectureId of Visual Studio 10 IA64 generator
6f439b3 VS: Remove AddPlatformDefinitions from platform-specific generators
5170a88 Make cmGlobalGenerator::GetDocumentation() a static function
04ff866 Allow a GeneratorFactory handling of more than one generator
984ebc3 Search generator in cmake::ExtraGenerators before in cmake::Generators
30a6950 Add cmGlobalGeneratorFactory::GetGenerators()
e8f8414 Introduce the abstract class cmGlobalGeneratorFactory
Since commit ca39c5cd (Optionally allow IMPORTED targets to be globally
visible, 2012-01-25) cmGlobalGenerator has a second member that tracks
targets with global scope. We must initialize the new 'ImportedTargets'
member wherever the old 'TotalTargets' member is initialized. Without
this initialization the ImportedTargets member is left with dangling
pointers during a same-process re-configuration.
We're going to need to link to them, and all the linking API is moving
to cmGeneratorTarget.
Skip imported targets when iterating over cmGeneratorTargets in places
where we only want targets we build. The GetGeneratorTargets result now
includes IMPORTED targets where it didn't before. The GetTargets
result, which was what used to be called in these methods does not
include IMPORTED targets. This doesn't relate to any known bugs, but in
some future uses of GetGeneratorTargets it will be important, so
starting the convention and being deliberate now is a good idea.
This fixes a regression introduced in commit 290e92ad (Move
GetIncludeDirectories to cmGeneratorTarget, 2012-09-16) which loops over
cmGeneratorTargets before they get created, so the container is empty.
4ad0233 Remove period at the end of the check message.
50b1ea5 Fix minor typos.
19c3206 Remove unused parameter marker and the unused parameter.
9d462b2 Document that generator expressions can be used in target properties.
daf88c3 Fix punctuation in some variables documentation.
3172cde Fix the layout of the generator expression documentation.
This way we don't need to check the definitions from the Makefile when
generating later, and can more easily add generator expressions.
Duplication is not a problem as the definitions are de-duplicated before
generating.
At the top of a build tree we configure inside the CMakeFiles directory
files such as "CMakeSystem.cmake" and "CMake<lang>Compiler.cmake" to
save information detected about the system and compilers in use. The
method of detection and the exact results store varies across CMake
versions as things improve. This leads to problems when loading files
configured by a different version of CMake. Previously we ignored such
existing files only if the major.minor part of the CMake version
component changed, and depended on the CMakeCache.txt to tell us the
last version of CMake that wrote the files. This led to problems if the
user deletes the CMakeCache.txt or we add required information to the
files in a patch-level release of CMake (still a "feature point" release
by modern CMake versioning convention).
Ensure that we always have version-consistent platform information files
by storing them in a subdirectory named with the CMake version. Every
version of CMake will do its own system and compiler identification
checks even when a build tree has already been configured by another
version of CMake. Stored results will not clobber those from other
versions of CMake which may be run again on the same tree in the future.
Loaded results will match what the system and language modules expect.
Rename the undocumented variable CMAKE_PLATFORM_ROOT_BIN to
CMAKE_PLATFORM_INFO_DIR to clarify its purpose. The new variable points
at the version-specific directory while the old variable did not.
When a language is not enabled at the top level of a project but is
enabled in multiple disjoint subdirectories we should re-use the
CMake<lang>Compiler.cmake file from the first directory. Load the file
whenever it exists and is not left from a different version of CMake.
bd34963 Refactor generation of shared library flags
55d7aa4 Add platform variable for flags specific to shared libraries
31d7a0f Add platform variables for position independent code flags
CMAKE_SHARED_LIBRARY_<lang>_FLAGS has flags on various platforms for a
variety of purposes that are correlated with shared libraries but not
exclusive to them. Refactor generation of these flags to use new
purpose-specific platform variables
CMAKE_<lang>_COMPILE_OPTIONS_DLL
CMAKE_<lang>_COMPILE_OPTIONS_PIC
CMAKE_<lang>_COMPILE_OPTIONS_PIE
Activate the DLL flags specifically for shared libraries. Add a new
POSITION_INDEPENDENT_CODE target property to activate PIC/PIE flags, and
default to true for shared libraries to preserve default behavior.
Initialize the new property from CMAKE_POSITION_INDEPENDENT_CODE to
allow easy global configuration in projects.
Although the default behavior is unchanged by this refactoring, the new
approach ignores CMAKE_SHARED_LIBRARY_<lang>_FLAGS completely. We must
leave it set in case projects reference the value. Furthermore, if a
project modifies CMAKE_SHARED_LIBRARY_<lang>_FLAGS it expects the new
value to be used. Add policy CMP0018 to handle compatibility with
projects that modify this platform variable.
Add a PositionIndependentCode test on platforms where we can get
meaningful results.