Commit Graph

21 Commits

Author SHA1 Message Date
Stephen Kelly 3b880a0741 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a
cmState::Snapshot.  Adjust MakeLocalGenerator to use the 'current'
snapshot in cases where there is no parent.  Create the snapshot
for subdirectories in cmMakefile::AddSubdirectory.

This means that snapshots are now created at the point of extending the tree,
as appropriate, and independently of the cmLocalGenerator and cmMakefile they
represent the state for.
2015-05-27 09:18:32 -04:00
Stephen Kelly e12afe766e cmState: Host some state from the cmGlobalGenerator. 2015-05-27 09:18:31 -04:00
Stephen Kelly 01e1cd5c1f cmState: Move snapshot creation to the cmake instance.
Don't create a snapshot in Initialize(), but leave the creation
responsibility to the cmake instance instead.  Previously, the
cmState would Initialize() in its constructor, and the cmake instance
would re-Initialize() during Configure().  The end result was the
same and there would be one snapshot present.  However, cmLocalGenerator
also created a snapshot on construction, and that one was used, leaving
the first snapshot unused, and potential for off-by-one errors.

Fix that by making the cmLocalGenerator use the existing snapshot
if it is top-level.  Add a CurrentSnapshot to the cmake instance and
populated it while configuring a directory.  This will eventually
replace the 'current local generator' concept.  Fix the GetParent
implementation to be able to return the first snapshot.
2015-05-24 13:30:24 +02:00
Stephen Kelly 9e4b6cc2ce cmState: Store computed relative paths to to current directories. 2015-05-16 08:12:02 +02:00
Stephen Kelly 991f5e4968 cmState::Snapshot: Store components for current directories.
Remove this responsibility from cmLocalGenerator.
2015-05-16 08:12:01 +02:00
Stephen Kelly 57bdc1a2f7 cmState: Compute and store directory components.
There is no need to duplicate these in all cmLocalGenerators.

Rename the symbols according to current conventions.

Add explicit calls to Set{Source,Binary}Directory with empty strings
in order to trigger the population of the components containers with
the current working directory in cmLocalGenerator.  Having
directories set to empty is a special case in CMake, which is relied
on for the `if(CMAKE_BINARY_DIR)` condition at the end of
CMakeDetermineSystem.cmake.
2015-05-16 08:11:33 +02:00
Stephen Kelly 48a9e91b02 cmState: Add an accessor for Parent snapshot and a validity check. 2015-05-14 20:36:28 +02:00
Stephen Kelly 83dc483e4e cmState: Truncate snapshot data in Initialize.
When Configure is executed multiple times with the same cmake
instance (either using CTest --two-config or a interactive gui), the
location and structural data was preserved though it would not be used
again.  Fix that by clearing the data in a method called early in
the configure step.
2015-05-03 20:36:29 +02:00
Brad King a588d1ee99 Merge topic 'fix-cmState-try_compile-languages'
27343e3b cmGlobalGenerator: Finish storing enabled languages in cmState
2015-05-01 13:16:12 -04:00
Brad King 27343e3b68 cmGlobalGenerator: Finish storing enabled languages in cmState
In commit 74de9a73 (cmGlobalGenerator: Delegate storage of enabled
languages to cmState, 2015-04-11) the original LanguageEnabled
member of cmGlobalGenerator was left behind by mistake.  One use
of it in EnableLanguagesFromGenerator (for try_compile) was left,
but the member is not populated anymore.  Drop the member and
teach EnableLanguagesFromGenerator to copy the list of enabled
languages from one cmState to the other.

Reported-by: Matt McCormick <matt.mccormick@kitware.com>
2015-04-30 09:08:25 -04:00
Stephen Kelly 46f6a5f458 cmState: Store the Current directories. 2015-04-28 07:57:21 +02:00
Stephen Kelly 3a041c5949 Introduce cmState::Snapshot.
Create snapshots for buildsystem directories during configure time.

This class will be extended in follow up commits to snapshot
all values in the cmState.
2015-04-28 07:57:01 +02:00
Stephen Kelly ae6c8a9d68 cmState: Store the Source and Binary directories. 2015-04-28 07:50:57 +02:00
Stephen Kelly de722d7d63 Move property initialization to cmState. 2015-04-15 11:43:50 -04:00
Stephen Kelly 9b5f80a83c Move global properties to cmState. 2015-04-15 11:43:50 -04:00
Stephen Kelly 96f8c5f9a3 cmState: Move cmCommand-related methods from cmake class. 2015-04-13 21:12:14 +02:00
Stephen Kelly 62854e9966 cmState: Move try_compile state from cmake class. 2015-04-13 20:27:36 +02:00
Stephen Kelly 74de9a734c cmGlobalGenerator: Delegate storage of enabled languages to cmState. 2015-04-13 20:19:58 +02:00
Stephen Kelly b159bff732 Move property definition to cmState. 2015-04-13 20:13:13 +02:00
Stephen Kelly f081c5bddd cmState: Move CacheEntryType enum from cmCacheManager. 2015-04-13 11:44:16 -04:00
Stephen Kelly a6b1ad1309 Introduce cmState class.
At this point, it is an interface to the cache.  It will be extended
to be a universal interface for access to and manipulation of
configuration-time data (defintions, properties on targets,
directories, source files etc).

This will allow porting all command implementations away
from the cmMakefile and cmTarget classes, and result in something
more-purely related to configuration-time processing of cmake
commands.  That should serve at least the following goals:

 * Split the CMake implementation more definitively into three
   stages: Configuration, computation and generation, and be able to
   implement each optimally for memory access patterns etc.
 * Make better IDE integration possible by making more configuration
   data available.
 * Make it possiblte to use a smaller library than CMakeLib.a in
   cpack and ctest, resulting in smaller executables.
 * Make it possible to run the configure step multiple times in
   the same CMake run (#14539).

Manage its lifetime in the cmake class, and add a convenience accessor
to cmMakefile.
2015-04-13 11:44:14 -04:00