Commit Graph

155 Commits

Author SHA1 Message Date
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
Brad King 6bea84353c Factor out global generator ComputeTargetDepends method
Put the global dependency analysis in its own method so individual
generators can hook into this point.
2010-08-24 18:12:44 -04:00
Brad King 41a608a75d Fix rule hash persistence file generation
We store custom command rule hashes in CMakeFiles/CMakeRuleHashes.txt
persistently across CMake runs.  When the rule hash changes we delete
the custom command output file and write a new hash into the persistence
file.

This functionality was first added by the commit 'Introduce "rule
hashes" to help rebuild files when rules change.' (2008-06-02).
However, the implementation in cmGlobalGenerator::CheckRuleHashes kept
the file open for read when attempting to rewrite a new file.  On
Windows filesystems this prevented the new version of the file from
being written!  This caused the first set of rule hashes to be used
forever within a build tree, meaning that all custom commands whose
rules changed would be rebuilt every time CMake regenerated the build
tree.

In this commit we address the problem by splitting the read and write
operations into separate methods.  This ensures that the input stream is
closed before the output stream opens the file.
2010-02-12 08:00:53 -05:00
David Cole 0b38bb4c53 Fix issue #2336 - honor the -C arg to ctest. Honor it for all stages of running -D dashboards from the command line and running ctest_configure, ctest_build and ctest_test commands in -S scripts. Also, allow a script to change it by setting the CTEST_CONFIGURATION_TYPE variable: allows for multiple configuration build/test cycles within one script. Add a new signature for the cmake command build_command that accepts CONFIGURATION as one argument. The original build_command signature is still there, but now marked as deprecated in the documentation. Of course... also add CTestConfig tests to verify that -C is honored for -D dashboards and -S scripts. 2009-12-04 12:09:01 -05:00
Brad King 9000b5a4de Avoid non-root copies of root-only targets
In cmGlobalGenerator::GetTargetSets we collect targets from all local
generators in a tree or subtree corresponding to a project() command.
Some targets, such as ALL_BUILD, are duplicated in each subdirectory
with a project() command.  For such targets we should keep only the copy
for the top-most (root) local generator.

Previously this filtering was done in each VS IDE generator, but it is
easier to do it in one place when the targets are first encountered.
This also fixes bad ALL_BUILD dependencies generated for VS 7.0 because
the cmGlobalVisualStudio7Generator::WriteTargetDepends method was not
filtering out duplicates.  Now we avoid duplicates from the start.
2009-10-06 13:30:00 -04:00
Brad King c8ddb6813b Cleanup cmGlobalGenerator::GetTargetSets method
This commit cleans up the declaration, definition, and invocations of
the GetTargetSets method and related code.  There is no change in
function except to make the method virtual.
2009-10-01 10:26:54 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
Brad King 80c947b397 No /fast targets in try_compile project mode
The try_compile command builds the cmTryCompileExec executable using the
cmTryCompileExec/fast target with Makefile generators in order to save
time since dependencies are not needed.  However, in project mode the
command builds an entire source tree that may have dependencies.
Therefore we can use the /fast target approach only in one-source mode.
2009-08-04 14:37:46 -04:00
Brad King 73de2362dd Fix recursive try_compile calls
When building an entire source tree with try_compile instead of just a
single source file, it is possible that the CMakeLists.txt file in the
try-compiled project invokes try_compile.  This commit fixes propagation
of language-initialization results from the outer-most project into any
number of try-compile levels.
2009-08-03 13:37:36 -04:00
Bill Hoffman 300514fd25 ENH: make sure GUIDs for filters are cached 2009-07-17 10:05:54 -04:00
Brad King a232dbe8d2 BUG: Fix Xcode linker language
Xcode does not seem to support direct requests for using the linker for
a particular language.  It always infers the linker using the languages
in the source files.  When no user source files compile with target's
linker language we add one to help Xcode pick the linker.

A typical use case is when a C executable links to a C++ archive.  The
executable has no C++ source files but we need to use the C++ linker.
2009-07-10 16:51:44 -04:00
Brad King a86e81c358 ENH: Generate a central list of target directories
This generalizes the previous CMakeFiles/LabelFiles.txt created at the
top of the build tree to a CMakeFiles/TargetDirectories.txt file.  It
lists the target support directories for all targets in the project.
Labels can still be loaded by looking for Labels.txt files in each
target directory.
2009-03-09 12:19:27 -04:00
Brad King d35651fb6c ENH: Extend GG::Build method for pre-parsed args
This adds an argument to the cmGlobalGenerator::Build method to pass a
vector of arguments for the native build tool programatically.
2009-03-04 15:38:47 -05:00
Brad King 1d3308156e ENH: Enforce unique binary directories
The second argument of add_subdirectory must name a unique binary
directory or the build files will clobber each other.  This enforces
uniqueness with an error message.
2009-02-27 11:23:14 -05:00
Brad King 13f9bb646d ENH: Define target and source property LABELS
This creates a new LABELS property for targets and source files.  We
write the labels of each target and its source files in target-specific
locations in the build tree for future use.
2009-02-10 08:50:21 -05:00
Brad King ac9b7ec155 ENH: Refactor custom command rule hashing
This simplifies computation of custom command rule hashes to hash
content exactly chosen as the custom commands are generated.
Unfortunately this will change the hashes of existing build trees from
earlier CMake versions, but this is not a big deal.  The change is
necessary so that in the future we can make optional adjustments to
custom command lines at generate time without changing the hashes every
time the option is changed.
2009-02-02 13:28:12 -05:00
Bill Hoffman 1777bb502a BUG: 4244, add a --build option to cmake that can build projects configured by CMake 2008-10-15 13:56:07 -04:00
Bill Hoffman ab409fec89 BUG: fix for 7738, allow for spaces in the package target path to CPackConfig files 2008-10-01 09:50:11 -04:00
Brad King 4719984553 ENH: Make dir content cache work during configure
Previously the cmGlobalGenerator::GetDirectoryContent method would work
safely only during build system generation.  These changes make it safe
to use during each configure step by flushing it at the beginning.
2008-09-22 10:56:48 -04:00
Brad King 2bc9acb1ca BUG: Fix try_compile during EnableLanguage
- The source-file signature of try_compile looks up the language
    of the source file using the extension-to-language map so that
    it knows what language to enable in the generated project.
  - This map needs to be filled before loading a file specified by
      CMAKE_USER_MAKE_RULES_OVERRIDE
      CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG>
    so that the user file may call the try_compile() source-file
    signature.
  - It must still be re-filled after loading CMake<LANG>Information.cmake
    in case the compiler- or platform-specific files added anything.
  - See bug #7340.
2008-07-16 11:03:58 -04:00
David Cole 83ec8c3593 ENH: Further refinement of the CPack components functionality from Doug Gregor.
Details:
==========

 - New cpack_add_component, cpack_add_component_group, and
cpack_add_install_type "commands" defined as macros in the CPack
module.
 - Documentation for all of the variables and commands in the CPack module.
 - Added get_cmake_property(... COMPONENTS) to CMake to ask for the
names of all components. Used in the CPack module to automatically
build component-based installers. (Set CPACK_MONOLITHIC_INSTALL to
turn off component-based installation).
 - A group can declare its PARENT_GROUP, to build an arbitrary
hierarchy of groups.
 - New CPack command cpack_configure_downloads, which creates an
installer that downloads only the selected components on-the-fly.
Those components marked DOWNLOADED will be separate packages
downloaded on-the-fly (or, all packages can be marked as such with the
ALL option to cpack_configure_downloads). Individual components are
compressed with ZIP at installer-creation time and
downloaded/uncompressed by the installer as needed. This feature is
only available on Windows with NSIS at the moment.
 - NSIS installers can install themselves and enable the "Change"
button in Add/Remove programs, allowing users to go back and install
or remove components. This can be disabled through
cpack_configure_downloads, because it's only really useful is most of
the application's functionality is in downloaded components.
 - Bug fix: automatically install everything whose COMPONENT was not
specified (it's a hidden, required group)
 - Bug fix: fixed removal of components when re-running the NSIS
installer and unchecking components
 - Bug fix: NSIS installers now only install/remove the minimal
number of files when re-run to update the installation (or by clicking
"Change" in Add/Remove programs)
2008-07-08 11:52:25 -04:00
Brad King e79b73d61f BUG: Include less content as input to "rule hash" computation.
- The rule hash should use only commands specified by the user.
  - No make output (echo and progress) rules should be included.
  - No outputs or dependencies need be included.  The native build tool
    will take care of them.
2008-06-03 09:55:28 -04:00
Brad King 6be09c3667 ENH: Introduce "rule hashes" to help rebuild files when rules change.
- In CMake 2.4 custom commands would not rebuild when rules changed.
  - In CMake 2.6.0 custom commands have a dependency on build.make
    which causes them to rebuild when changed, but also when any
    source is added or removed.  This is too often.
  - We cannot have a per-rule file because Windows filesystems
    do not deal well with lots of small files.
  - Instead we add a persistent CMakeFiles/CMakeRuleHashes.txt file
    at the top of the build tree that is updated during each
    CMake Generate step.  It records a hash of the build rule for
    each file to be built.  When the hash changes the file is
    removed so that it will be rebuilt.
2008-06-02 16:44:58 -04:00
Brad King 1c0ffdc11c BUG: Fix crash on repeated configure steps and exported targets.
- In cmGlobalGenerator the ExportSets ivar must be cleared at
    the beginning of each Configure.
  - See issue #7101.
2008-05-27 11:18:01 -04:00
Brad King 771bdb7ef8 BUG: Make sure all source files are found before generating.
- Previously this was done implicitly by the check for a target
    link language which checked all source full paths.
  - The recent change to support computing a link language without
    finding all the source files skipped the implicit check.
  - This change adds an explicit check to find all source files.
2008-05-12 17:43:45 -04:00
Brad King 1c0595c73f ENH: Add global property ALLOW_DUPLICATE_CUSTOM_TARGETS to help existing projects that depend on having duplicate custom targets. It is allowed only for Makefile generators. See bug#6348. 2008-02-14 16:42:29 -05:00
Brad King 523ddedac5 ENH: Analyze inter-target dependencies to safely fix cycles
- Cycles may be formed among static libraries
  - Native build system should not have cycles in target deps
  - Create cmComputeTargetDepends to analyze dependencies
  - Identify conneced components and use them to fix deps
  - Diagnose cycles containing non-STATIC targets
  - Add debug mode property GLOBAL_DEPENDS_DEBUG_MODE
  - Use results in cmGlobalGenerator as target direct depends
2008-02-05 23:10:41 -05:00