Commit Graph

181 Commits

Author SHA1 Message Date
Brad King c247f1e175 Merge topic 'vs-generator-names'
29071fe VS: Add version year to generator names
2013-10-31 09:39:42 -04:00
Brad King 8a6e82724c Merge topic 'use-generator-target'
638843a Remove the Location member from cmTarget.
90ef1cf Move GenerateTargetManifest to cmGeneratorTarget.
25f1df3 Split CreateGeneratorTargets into two methods.
2013-10-30 14:55:35 -04:00
Brad King fcbe435c23 Merge topic 'Qt-auto-generators'
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.
...
2013-10-28 15:23:09 -04:00
Brad King 29071fed2e VS: Add version year to generator names
Rename the Visual Studio >= 10 generators to indicate the version year:

 Visual Studio 10 => Visual Studio 10 2010
 Visual Studio 11 => Visual Studio 11 2012
 Visual Studio 12 => Visual Stduio 12 2013

Report the names with the year to the list of available generators so
that the cmake-gui drop-down shows the years.  When selecting a
generator from the "-G" option or from an existing CMAKE_GENERATOR cache
entry, recognize names without the years for compatibility and map them
to the names with years.

Update the generator names in the cmake-generators.7 manual.
2013-10-28 13:43:14 -04:00
Brad King 3e04946f7b Require CMAKE_<LANG>_COMPILER to be found as a full path
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.
2013-10-28 08:36:14 -04:00
Stephen Kelly 25f1df3e81 Split CreateGeneratorTargets into two methods.
As the generate-time-related API is moving to cmGeneratorTarget, almost
all of generation code needs to be able to access instances of it.
2013-10-27 20:29:34 +01:00
Stephen Kelly 5c058c8f12 Rename the cmQtAutomoc class to cmQtAutoGenerators.
It will be extended to process .ui and .qrc files too.
2013-10-24 09:14:12 +02:00
Stephen Kelly 66b290e7e2 export(): Process the export() command at generate time.
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.
2013-10-11 12:46:10 +02:00
Stephen Kelly af1f698757 CMP0024: Store the fact of included export in global generator.
Storing it in the makefile means that the policy does not trigger
when include and export are in differing directories.
2013-10-10 12:01:39 +02:00
Brad King aa53ee57bb Add policy CMP0025 for Apple Clang compiler id compatibility
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.
2013-10-07 20:12:46 -04:00
Stephen Kelly 370bf55415 Add the ALIAS target concept for libraries and executables.
* 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.
2013-08-02 15:21:00 +02:00
Brad King be85fa4a89 Merge topic 'genex-generate-file'
b983a58 file: Add GENERATE command to produce files at generate time
2013-05-28 10:42:18 -04:00
Stephen Kelly b983a58bdf file: Add GENERATE command to produce files at generate time
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.
2013-05-24 09:02:45 -04:00
Petr Kmoch de8be9ef7d Add projectDir parameter to GenerateBuildCommand
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.
2013-04-12 11:35:35 -04:00
Peter Kümmel 751f712e1a Ninja: use MinGW generator code in EnableLanguage() 2013-03-09 11:28:45 +01:00
Brad King 4fd5342956 CMake: Add -T option to choose a generator toolset
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.
2013-02-07 10:53:19 -05:00
Patrick Gansterer 5170a8800f Make cmGlobalGenerator::GetDocumentation() a static function
Making the function static allows us to call it directly,
without creating and removing an instance of the generator.
2012-11-19 12:54:50 -05:00
Alex Neundorf 80112da54e Merge topic 'AutomocUseTargetProperties' into export-sets
Conflicts:
	Source/cmGlobalGenerator.h
2012-09-30 10:27:44 -04:00
Yury G. Kudryashov 5c898fbd99 exports: Add cmExportSetMap class
This is a map<string, cmExportSet *> with overloaded operator[] and destructor.
2012-09-28 09:21:39 -04:00
Yury G. Kudryashov d13ec1ac31 exports: Create class cmExportSet
Replace direct use of 'std::vector<cmTargetExport const*>' with a
dedicated class.
2012-09-28 09:21:39 -04:00
Yury G. Kudryashov 4e2347cbf3 exports: Rename cmGlobalGenerator::AddTargetToExport{s,}
This function adds target to one export, not to several exports.
2012-09-28 09:21:39 -04:00
Yury G. Kudryashov e846e7031f exports: Remove cmTargetExport constructor
The constructor was used exactly once.
Setting members explicitly makes the code more readable.
2012-09-28 09:21:39 -04:00
Alex Neundorf 65a30c69a2 cmGlobalGenerator.h: some minor coding style fixes
- this-> was missing
- removed unnecessary semicolons
- indented unindented lines

Alex
2012-09-28 09:20:20 -04:00
Stephen Kelly 14bf7783f4 Store cmGeneratorTargets with the makefile. 2012-09-19 15:29:07 +02:00
David Cole c95d1baa19 Merge topic 'position-independent-targets'
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
2012-06-12 16:01:04 -04:00
Stephen Kelly bd34963002 Refactor generation of shared library 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.
2012-06-12 15:38:48 -04:00
Stephen Kelly 2c04bc00a4 Move the EscapeJSON method to a sharable location. 2012-06-04 23:42:37 +02:00
Brad King 369e3464be Factor out custom command .rule file path generation
Add cmGlobalGenerator::GenerateRuleFile to compute a generator-specific
rule file location.  This will allow specific generators to override the
location of .rule files without changing the behavior of other
generators.
2012-04-18 15:49:38 -04:00
Brad King 9c0a00d6dd Rename/constify build-time config placeholder lookup
Rename cmGlobalGenerator::GetCMakeCFG{InitDirectory => IntDir} to
have a shorter name without a typo.  Add a 'const' qualifier since
the method is only for lookup and never needs to modify anything.
2012-03-09 15:16:03 -05:00
Brad King 3baaf6ccec Pre-compute object file names before Makefile generation
Add a virtual cmGlobalGenerator::ComputeTargetObjects method invoked
during cmGeneratorTarget construction.  Implement it in the Makefile
generator to pre-compute all object file names for each target.  Use
the results during generation instead of re-computing it later.
2012-03-09 15:16:02 -05:00
Brad King 4b24558091 Create a cmGeneratorTarget for each cmTarget during generation
Construct the instances after the final set of targets is known but
before computing inter-target dependencies.  This order will allow
initialization of cmGeneratorTarget instances to adjust and finalize
declared inter-target dependencies.
2012-03-09 15:16:02 -05:00
Brad King ca39c5cdd1 Optionally allow IMPORTED targets to be globally visible
Consider the case motivating commit e01cce28 (Allow add_dependencies()
on imported targets, 2010-11-19).  An imported target references a file
generated at build time by a custom target on which it depends.  Had the
file been built directly using add_library or add_executable its target
name would have been visible globally.  Therefore the imported target
representing the file should be globally visible also.

Teach the IMPORTED signature of add_(executable|library) to accept a new
"GLOBAL" option to make the imported target visible globally.
2012-01-25 14:42:31 -05:00
Nicolas Despres d0b3a7fa48 Fix typo. 2011-10-23 22:15:30 +02:00
Brad King 32f8437bbf Fix line-too-long style violations
Commit 8a0eb78f (Constify many getters of cmGlobalGenerator, 2011-03-26)
added const qualifiers to many cmGlobalGenerator methods but left the
resulting lines beyond our style's limit of 79 characters.
2011-10-10 09:46:27 -04:00
Peter Collingbourne 557956f348 Introduce a cmGlobalGenerator::ResolveLanguageCompiler function
It is factored out of cmGlobalUnixMakefileGenerator3::EnableLanguage,
and may be used by other generators to resolve CMAKE_*_COMPILER
settings.
2011-10-02 18:30:43 +01:00
Nicolas Despres 8a0eb78f3b Constify many getters of cmGlobalGenerator. 2011-10-02 18:30:42 +01:00
Nicolas Despres 4532d36cc9 Add const versions of some getters. 2011-10-02 18:30:42 +01:00
Alex Neundorf 50cd6cef92 Move automoc processing from add_executable/library to cmGlobalGenerator
Now automoc is enabled by setting the AUTOMOC target property to true,
instead of using the AUTOMOC keyword in add_executable() or add_library()

Alex
2011-08-16 01:45:05 +02:00
Johan Björk 856a9e499f RunSingleCommand: Replace verbose boolean with enum
No behaviour change, this prepares for adding a flag to skip the merging
of output streams.
2011-07-28 10:42:03 -04:00
Brad King 833b8aa902 Merge topic 'recursive-CMAKE_USER_MAKE_RULES_OVERRIDE'
c83a834 try_compile: Allow only languages loaded in caller (#11469)
2011-01-26 15:25:18 -05:00
Brad King c83a834d29 try_compile: Allow only languages loaded in caller (#11469)
During a try_compile cmGlobalGenerator::EnableLanguage uses results from
the outer project.  Reject attempts to enable languages in the test
project that are not "ready" in the outer project.  Mark a language as
"ready" when all its information has been loaded and we are ready to
generate build rules.

This also avoids infinite recursion introduced by commit 295b5b60 (Honor
CMAKE_USER_MAKE_RULES_OVERRIDE in try_compile, 2010-06-29) for projects
that set CMAKE_USER_MAKE_RULES_OVERRIDE to a file that uses try_compile.
The file is loaded along with the information for a given langauge so
the language is not yet "ready".
2011-01-24 10:00:45 -05:00
Brad King 8e82773eb4 Remove unused GLOBAL_TARGET generation code
Remove a boolean parameter of cmGlobalGenerator::CreateGlobalTarget that
is never set to true anymore.  Remove global target "consolidation" loop
because no global targets exist before it runs anymore.
2010-12-13 12:59:26 -05:00
Brad King bc7395c096 Merge branch 'vs-target-dependencies' into imported-target-dependencies 2010-11-19 13:23:17 -05:00
Brad King 605f4bc097 Record edge type in global dependency graph
Each inter-target dependency may be a 'link' or 'util' dependency.
2010-11-18 10:51:00 -05:00
Alex Neundorf 156ae39905 Don't disable colors in the CodeBlocks generator and minor cleanup.
Since now the only users of SetToolSupportsColor() are gone, this
method is removed too.

Alex
2010-11-11 22:13:39 +01:00
Alex Neundorf 7b1421b885 Remove trailing whitespace
Alex
2010-11-11 22:02:07 +01:00
Brad King 28edb70a9e Merge topic 'vs-project-groups'
e6ac0aa Add FOLDER target property, for IDEs (#3796)
2010-09-08 11:08:05 -04:00
David Cole e6ac0aacf6 Add FOLDER target property, for IDEs (#3796)
This work was started from a patch by Thomas Schiffer.
Thanks, Thomas!

See the newly added documentation of the FOLDER target
property for details.

Also added global properties, USE_FOLDERS and
PREDEFINED_TARGETS_FOLDER. See new docs here, too.

By default, the FOLDER target property is used to organize
targets into folders in IDEs that have support for such
organization.

This commit adds "solution folder" support to the Visual
Studio generators. Currently works with versions 7 through
10.

Also, use the new FOLDER property in the ExternalProject
test and in the CMake project itself.
2010-09-03 13:53:22 -04:00
Brad King 6c155d9e9e Merge topic 'vs-utility-depends'
a99f620 Fix unused parameter warning in VS 7.1 generator
79a88c3 Refactor VS <= 7.1 utility-depends workaround
325bdb2 Factor out duplicate VS target dependency code
6bea843 Factor out global generator ComputeTargetDepends method
2010-08-31 14:38:18 -04:00
Brad King 95b3bb5dbc Restore GetTargetDirectDepends const return
The returned set should never be modified.  Restore 'const' correctness
unnecessarily removed by commit 6903d2df (remove const, 2008-01-30).
2010-08-25 17:05:01 -04:00