Commit Graph

264 Commits

Author SHA1 Message Date
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 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
Brad King d5eb99cb6f Simplify CMake self-install special case
CMake has a special case for the "make install" target when building
CMake itself.  We use the just-built CMake to install itself since an
existing CMake installation cannot replace itself (at least on Windows).
We simplify the code that computes the location of the CMake binary by
taking advantage of existing generator support for target lookup.  This
will make it robust to any changes in CMake's own CMakeLists.txt files
in the future.
2009-12-10 09:09:50 -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
David Cole a9dcc7fd47 Fix warnings in CMake source code. Suppress warnings in Lexer and Parser files that are 'too hard' to fix. 2009-09-30 11:41:34 -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 0af3b3b802 Speed up graph traversal for project->targets map
The cmGlobalGenerator::AddTargetDepends method traces the dependencies
of targets recursively to collect the complete set of targets needed for
a given project (for VS .sln files).  This commit teaches the method to
avoid tracing its dependencies more than once.  Otherwise the code does
an all-paths walk needlessly.
2009-09-02 16:06:43 -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 7491f52992 ENH: first pass at VS 10, can bootstrap CMake, but many tests still fail 2009-06-25 16:41:57 -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 7590ad17ad BUG: Fix logic of LabelFiles.txt generation
This fixes a dumb logic error which causes generation of LabelFiles.txt
to try to open the file once for every target with labels.
2009-02-12 13:25:15 -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 fd40f27420 COMP: Fix rule hash code during bootstrap
During bootstrap we do not bother with rule hashing.  This updates the
dummy implementation to account for the recent change in rule hash
method signatures.
2009-02-02 14:36:45 -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 7d1bbb872c BUG: fix package_source target 2008-11-10 13:42:52 -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 049e3da2ec STYLE: fix hidden variable warning 2008-10-01 12:45:49 -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 f49f1d2973 ENH: Simplify NOTFOUND variable check
When looking for NOTFOUND libraries, use the direct dependencies of a
target instead of all dependencies.  At least one target will trigger
the NOTFOUND error anyway because at least one must directly link it.
This removes another use of the old-style link line computation.
2008-09-15 13:46:56 -04:00
Bill Hoffman 513f7d1869 BUG: fix for 7496, do not just report configure done when there is an error during configure 2008-08-19 13:48:21 -04:00
Brad King 578e83501b BUG: Fix crash on circular target dependencies
After reporting an error about circular target dependencies do not try
to continue generation because the dependency computation object is not
in a useful state.
2008-08-06 17:48:44 -04:00
Bill Hoffman beeebcdc40 BUG: fix for bug 7427, preinstall target name hard coded 2008-07-30 15:18:19 -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
Bill Hoffman 70662e7f86 COMP: fix warning 2008-07-05 09:29:33 -04:00
Bill Hoffman bb7b27e417 ENH: add initial ctest -j feature 2008-07-03 09:31:33 -04:00
Alexander Neundorf 3e909b5908 BUG: -fail with error if the CMake<LANG>Information.cmake file wasn't found
ENH: -if no compiler has been found, don't test it, and also remove the compiler
information file again. This makes optionally enabling a language work
better.

Alex
2008-06-10 18:28:01 -04:00
Brad King 2453164126 COMP: Fix bootstrap build after previous change to signature of AddRuleHash. 2008-06-03 10:02:18 -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 1381aab4b7 BUG: Remove check for files written by file(WRITE) being loaded.
- CMake 1.8 and below did not do the check but could get in
    infinite loops due to the local generate step.
  - CMake 2.0 added the check but failed to perform it in directories
    with no targets (see bug #678).
  - CMake 2.2 removed the local generate which fixed the problem but
    did not remove the check.
  - Between CMake 2.4 and 2.6.0rc6 the check was fixed to work even
    when no targets appear in a directory (see bug #6923).
  - Bottom line: the check is no longer needed.
2008-04-30 13:42:40 -04:00
Brad King 53e0ed3273 BUG: Fix crash when CMAKE_BACKWARDS_COMPATIBILITY is not set. 2008-03-04 18:41:52 -05: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
Ken Martin 22835a71cd ENH: really Bill, using Ken's checkout, fix output in ctest so clean output in build and test is not lost, also display the command lines used 2008-02-01 16:05:40 -05:00
Bill Hoffman 48b554dee8 ENH: remove a const cast 2008-01-31 12:19:00 -05:00
Bill Hoffman 6903d2df8b ENH: remove const 2008-01-30 22:56:34 -05:00
Bill Hoffman 8a83f09637 ENH: fix for bug 3218 dependant projects are written out automatically if they are in the project. Also fix bug 5829, remove hard coded CMAKE_CONFIGURATION_TYPES from vs 7 generator 2008-01-30 12:04:38 -05:00
Brad King 28ea034737 ENH: Support exporting/importing of Framework targets.
- Imported frameworks have the FRAMEWORK property set
  - Added cmTarget::IsFrameworkOnApple method to simplify checks
  - Also remove separate IMPORTED_ENABLE_EXPORTS property and just use ENABLE_EXPORTS since, like FRAMEWORK, it just represents the target type.
  - Document FRAMEWORK keyword in INSTALL command.
  - Updated IMPORTED_LOCATION property documentation for Frameworks
2008-01-28 13:05:58 -05:00
Brad King 5594ad4885 ENH: Updated exporting and importing of targets to support libraries and configurations.
- Created cmExportFileGenerator hierarchy to implement export file generation
  - Installed exports use per-config import files loaded by a central one.
  - Include soname of shared libraries in import information
  - Renamed PREFIX to NAMESPACE in INSTALL(EXPORT) and EXPORT() commands
  - Move addition of CMAKE_INSTALL_PREFIX to destinations to install generators
  - Import files compute the installation prefix relative to their location when loaded
  - Add mapping of importer configurations to importee configurations
  - Rename IMPORT targets to IMPORTED targets to distinguish from windows import libraries
  - Scope IMPORTED targets within directories to isolate them
  - Place all properties created by import files in the IMPORTED namespace
  - Document INSTALL(EXPORT) and EXPORT() commands.
  - Document IMPORTED signature of add_executable and add_library
  - Enable finding of imported targets in cmComputeLinkDepends
2008-01-28 08:38:36 -05:00
Brad King 96fd5909d9 ENH: Implement linking with paths to library files instead of -L and -l separation. See bug #3832
- This is purely an implementation improvement.  No interface has changed.
  - Create cmComputeLinkInformation class
  - Move and re-implement logic from:
      cmLocalGenerator::ComputeLinkInformation
      cmOrderLinkDirectories
  - Link libraries to targets with their full path (if it is known)
  - Dirs specified with link_directories command still added with -L
  - Make link type specific to library names without paths
    (name libfoo.a without path becomes -Wl,-Bstatic -lfoo)
  - Make directory ordering specific to a runtime path computation feature
    (look for conflicting SONAMEs instead of library names)
  - Implement proper rpath support on HP-UX and AIX.
2008-01-22 09:13:04 -05:00
David Cole 546c839d04 ENH: Add a dependency from the PACKAGE target to the ALL target so that "make package" will first (essentially) do a "make all"... A similar chunk of code already existed for the make install target. This change makes it easy to build an installer package as part of a dashboard run simply by setting CTEST_BUILD_TARGET to "package". 2007-12-31 17:29:20 -05:00
Brad King 70f73adccb COMP: Fix build on VS6. 2007-12-24 11:15:45 -05:00
Brad King 430296dc96 ENH: Moved global inter-target dependency analysis and cycle-prevention code up from cmGlobalUnixMakefileGenerator3 to cmGlobalGenerator. Simplified cmGlobalUnixMakefileGenerator3 to use it. Later other generators may be modified to use it also. 2007-12-23 15:03:42 -05:00