Commit Graph

534 Commits

Author SHA1 Message Date
Bill Hoffman 3d68dd230d Fix for bug #11274, VS10 custom commands that create files in INTDIR fix. 2010-09-29 17:02:04 -04:00
Brad King b06fb16684 No CMAKE_CONFIGURATION_TYPES in single-config generators (#10202)
Factor out reading of CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE
into cmMakefile::GetConfigurations.  Read the former only in
multi-config generators.
2010-09-08 14:54:49 -04:00
Brad King 3ebb41d58a Merge branch 'version' 2010-05-17 13:34:29 -04:00
Brad King 6e1b510319 Remove unused cmData and cmMakefile::DataMap
These were implementation details of the unused methods

  cmMakefile::RegisterData
  cmMakefile::LookupData

We simply remove the methods, members, and class cmData.
2010-04-26 14:22:51 -04:00
Brad King 5bfffd6f29 New version scheme to support branchy workflow
Prepare to switch to the workflow described by "git help workflows".  In
this workflow, the "master" branch is always used to integrate topics
ready for release.  Brand new work merges into a "next" branch instead.
We need a new versioning scheme to work this way because the version on
"master" must always increase.

We no longer use an even/odd minor number to distinguish releases from
development versions.  Since we still support cvs checkout of our source
tree we cannot depend on "git describe" to compute a version number
based on the history graph.  We can use the CCYYMMDD nightly date stamp
to get a monotonically increasing version component.

The new version format is "major.minor.patch.(tweak|date)".  Releases
use a tweak level in the half-open range [0,20000000), which is smaller
than any current or future date.  For tweak=0 we do not show the tweak
component, leaving the format "major.minor.patch" for most releases.
Development versions use date=CCYYMMDD for the tweak level.  The
major.minor.patch part of development versions on "master" always
matches the most recent release.

For example, a first-parent traversal of "master" might see

        v2.8.1      2.8.1.20100422    v2.8.2
           |              |              |
  ----o----o----o----o----o----o----o----o----

Since the date appears in the tweak component, the next release can
increment the patch level (or any more significant component) to be
greater than any version leading to it.  Topic branches not ready for
release are published only on "next" so we know that all versions on
master lead between two releases.
2010-04-23 09:44:23 -04:00
Brad King 59f6f383e9 Warn on set(PARENT_SCOPE) at top scope
Previously we silently ignored such calls and set nothing.  The commit
"Initialize directory scope with closure of parent" inroduced a bad test
for the top scope.  This commit fixes the test to avoid dereferencing a
null pointer, and adds a warning when the case is encountered.
2009-11-02 11:56:17 -05:00
Brad King 9a77f65da7 Remove CMake Policy CMP0015 until it is revised
We revert commit "Create CMake Policy CMP0015 to fix set(CACHE)" because
the NEW behavior of the policy breaks a valid use case:

  # CMakeLists.txt
  option(BUILD_SHARED_LIBS "..." ON)
  add_library(mylib ...)
  set(BUILD_SHARED_LIBS OFF) # we want only mylib to be shared
  add_subdirectory(ThirdParty)

  # ThirdParty/CMakeLists.txt
  option(BUILD_SHARED_LIBS "..." ON)
  # uh, oh, with NEW behavior this dir uses shared libs!!!

We'll re-introduce the policy later with a different change in behavior
to resolve the motivating case, which was more subtle but less common.

See issue #9008.
2009-10-08 14:56:15 -04:00
Brad King 1b5a986a42 Do not collapse path of NOTFOUND values
In cmMakefile::AddCacheDefinition we collapse paths specified in PATH or
FILEPATH cache entries originally specified on the command line with
UNINITALIZED type.  This commit fixes the logic to avoid collapsing
<var>-NOTFOUND and other false values.  The change allows other CMake
code to force a NOTFOUND value on an entry with UNINITALIZED type.
2009-10-07 14:37:19 -04:00
Brad King 78f0811628 Create explicit cmTarget::FinishConfigure step
This method is called during ConfigureFinalPass on every target.  It
gives each target a chance to do some final processing after it is known
that no more commands will affect it.  Currently we just call the old
AnalyzeLibDependencies that used to be called directly.
2009-10-05 09:06:29 -04:00
Brad King c513962701 Create INTERPROCEDURAL_OPTIMIZATION build feature
This commit creates target and directory properties to enable the Intel
interprocedural optimization support on Linux.  Enabling it adds the
compiler option '-ipo' and uses 'xiar' to create archives.

See issue #9615.
2009-10-02 13:52:13 -04:00
Brad King 1e48243591 Introduce "build feature" lookup framework
This creates cmTarget::GetFeature and cmMakefile::GetFeature methods to
query "build feature" properties.  These methods handle local-to-global
scope and per-configuration property lookup.  Specific build features
will be defined later.
2009-10-02 13:52:01 -04:00
Brad King 56d1a1780d Create cmMakefile::PlatformIs64Bit helper method
This method centralizes tests for whether CMAKE_SIZEOF_VOID_P is 8.
2009-09-30 13:45:14 -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 ef8434284f Remove old check for duplicate subdirectories
In cmMakefile::AddSubDirectory we were checking for addition of the same
source directory multiple times.  However, the check code was incorrect
because it compared pointers instetad of pointed-to strings.  Since the
check was written, a better check was added right after it to enforce
unique binary directories (in which case duplicate sources are fine).
This commit simply removes the old-style check code.
2009-09-17 08:25:33 -04:00
Brad King 24861459b5 Initialize directory scope with closure of parent
The commit "Improve dynamic variable scope implementation" optimized
function scopes using an efficient parent scope pointer.  However, the
parent scope used to initialize a new directory might not exist later
(like add_subdirectory called inside a function of the parent scope).
This caused CMake to crash when following the dangling pointer to the
original parent scope.

We fix the problem in this commit by always computing the closure of the
parent scope at directory initialization time so that no parent scope
pointer is needed.  See issue #9538.
2009-09-16 09:51:47 -04:00
Brad King ee2b446c95 Create CMake Policy CMP0015 to fix set(CACHE)
The set(CACHE) and option() commands should always expose the cache
value.  Previously we failed to expose the value when it was already set
if a local variable definition hid it.  When set to NEW, this policy
tells the commands to always remove the local variable definition to
expose the cache value.  See issue #9008.
2009-09-10 16:59:45 -04:00
Brad King afbe088309 Remove barely-used cmMakefile::AddCacheDefinition
The boolean overload of this method was used only to implement option().
We re-implement option() in terms of the main method and removes the
now-unused signature.  This removes some duplicate code that had already
fallen behind on changes (it was not removing the local definition
instead of setting it).
2009-09-10 16:59:36 -04:00
Brad King 0bc050677f Record backtrace for every add_test command
We teach cmTest to hold a backtrace for the add_test command that
created it.  This will be used later to report context for errors at
generate time.
2009-08-11 09:07: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 71c0e1417b ENH: Keep only FinalPass commands in memory
In cmMakefile we save all invoked commands so that FinalPass can be
called on them later.  Most commands have no final pass, so we should
keep only the few that do.
2009-07-24 13:31:34 -04:00
Brad King fd10589995 ENH: Improve dynamic variable scope implementation
Previously each new variable scope (subdirectory or function call) in
the CMake language created a complete copy of the key->value definition
map.  This avoids the copy using transitive lookups up the scope stack.
Results of queries answered by parents are stored locally to maintain
locality of reference.

The class cmDefinitions replaces cmMakefile::DefinitionsMap, and is
aware of its enclosing scope.  Each scope stores only the definitions
set (or unset!) inside it relative to the enclosing scope.
2009-07-22 14:22:45 -04:00
Bill Hoffman 300514fd25 ENH: make sure GUIDs for filters are cached 2009-07-17 10:05:54 -04:00
Bill Hoffman 28b1912aa3 ENH: add group support and fix borland error 2009-07-11 00:05:20 -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 f74b876a58 ENH: Clarify COMPILE_DEFINITIONS separator in docs
The COMPILE_DEFINITIONS properties are semicolon-separated lists.
Make this clear in the documentation.  See issue #9199.
2009-06-24 09:36:29 -04:00
Brad King c790b1fabb ENH: Create CMP0013 to disallow duplicate dirs
In CMake 2.6.3 and below we silently accepted duplicate build
directories whose build files would then conflict.  At first this was
considured purely a bug that confused beginners but would not be used in
a real project.  In CMake 2.6.4 we explicitly made it an error.

However, some real projects took advantage of this as a "feature" and
got lucky that the subtle build errors it can cause did not occur.
Therefore we need a policy to deal with the case more gracefully.
See issue #9173.
2009-06-17 13:40:09 -04:00
Brad King 708d1cf1ee ENH: Support more preprocessor values in VS6
Previously we rejected all preprocessor definition values containing
spaces for the VS6 IDE generator.  In fact VS6 does support spaces but
not in combination with '"', '$', or ';', and only if we use the sytnax
'-DNAME="value with spaces"' instead of '-D"NAME=value with spaces"'.
Now we support all definition values that do not have one of these
invalid pairs.  See issue #8779.
2009-04-24 11:18:06 -04:00
Brad King 4085454658 ENH: Support preprocessor def values in VS6
The add_definitions() command and COMPILE_DEFINITIONS dir/tgt/src
properties support preprocessor definitions with values.  Previously
values were not supported in the VS6 generator even though the native
tool supports them.  It is only values with spaces that VS6 does not
support.  This enables support and instead complains only for values
with spaces.  See issue #8779.
2009-03-23 14:48:09 -04:00
Brad King 66d69f864a ENH: Refactor generation of CTestTestfile content
This moves code which generates ADD_TEST and SET_TESTS_PROPERTIES calls
into CTestTestfile.cmake files out of cmLocalGenerator and into a
cmTestGenerator class.  This will allow more advanced generation without
cluttering cmLocalGenerator.  The cmTestGenerator class derives from
cmScriptGenerator to get support for per-configuration script
generation (not yet enabled).
2009-03-16 10:40:46 -04: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 b604b98c56 ENH: Define RULE_LAUNCH_* properties
This defines global, directory, and target properties
RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK, and RULE_LAUNCH_CUSTOM.  Their
values specify 'launcher' command lines which are prefixed to compile,
link, and custom build rules by Makefile generators.
2009-02-10 08:51:15 -05:00
Brad King 7d6a5e097f ENH: More robust property lookup
This teaches cmMakefile::GetProperty and cmake::GetProperty methods to
return NULL when the property name is NULL, making them more robust and
consistent with the behavior of cmTarget::GetProperty.
2009-02-02 13:27:30 -05:00
Brad King c332e0bf3c ENH: Isolate policy changes in included scripts
Isolation of policy changes inside scripts is important for protecting
the including context.  This teaches include() and find_package() to
imply a cmake_policy(PUSH) and cmake_policy(POP) around the scripts they
load, with a NO_POLICY_SCOPE option to disable the behavior.  This also
creates CMake Policy CMP0011 to provide compatibility.  See issue #8192.
2009-01-22 13:18:40 -05:00
Brad King 3028ca756c ENH: Better policies for functions and macros
This teaches functions and macros to use policies recorded at creation
time when they are invoked.  It restores the policies as a weak policy
stack entry so that any policies set by a function escape to its caller
as before.
2009-01-22 13:16:47 -05:00
Brad King 26bf8b2cda ENH: Create notion of a 'weak' policy stack entry
A 'weak' poilcy stack entry responds normally to queries.  However,
setting a policy in a weak entry will recursively set the policy in the
next entry too.  This also gives the internal interface to create a weak
entry the option to provide an initial PolicyMap for it.
2009-01-22 13:16:27 -05:00
Brad King dfc181a1dc ENH: Create policy scope barriers
This creates a barrier mechanism to prevent user code from using
cmake_policy(POP) to pop a scope it didn't push with cmake_policy(PUSH).
2009-01-22 10:57:16 -05:00
Brad King a01eb6b27b ENH: Create automatic policy push/pop helper
This creates cmMakefile::PolicyPushPop to push and pop policy scope
automatically.  It also enforces balanced push/pop pairs inside the
scope it handles.
2009-01-22 10:56:50 -05:00
Brad King 8997f4760a ENH: Refactor policy stack representation
This defines PolicyMap as a public member of cmPolicies.  Its previous
role as a policy stack entry is now called PolicyStackEntry and
represented as a class to which more information can be added later.
2009-01-22 10:56:39 -05:00
Brad King 1dcc5b4558 ENH: Better handling of mismatched blocks
If a logical block terminates with mismatching arguments we previously
failed to remove the function blocker but replayed the commands anyway,
which led to cases in which we failed to report the mismatch (return
shortly after the ending command).  The recent refactoring of function
blocker deletion changed this behavior to produce an error on the ending
line by not blocking the command.  Furthermore, the function blocker
would stay in place and complain at the end of every equal-level block
of the same type.

This teaches CMake to treat the begin/end commands (if/endif, etc.) as
correct and just warns when the arguments mismatch.  The change allows
cases in which CMake 2.6.2 silently ignored a mismatch to run as before
but with a warning.
2009-01-21 09:49:00 -05:00
Brad King bca1026250 ENH: Better error message for unclosed blocks
This centralizes construction of the error message for an unclosed
logical block (if, foreach, etc.).  We record the line at which each
block is opened so it can be reported in the error message.
2009-01-21 09:48:20 -05:00
Brad King b8f5a934ec ENH: Refactor logical block enforcement
This uses a stack of 'barriers' to efficiently divide function blockers
into groups corresponding to each input file.  It simplifies detection
of missing block close commands and factors it out of ReadListFile.
2009-01-21 09:48:00 -05:00
Brad King 2c81e5fb5c ENH: Refactor function blocker deletion
When a function blocker decides to remove itself we previously removed
it at every return point from the C++ scope in which its removal is
needed.  This teaches function blockers to transfer ownership of
themselves from cmMakefile to an automatic variable for deletion on
return.  Since this removes blockers before they replay their commands,
we no longer need to avoid running blockers on their own commands.
2009-01-20 14:36:18 -05:00
Brad King a541cac325 ENH: Improve response to bad if or elseif
Previously bad arguments to an if() or elseif() would cause some
subsequent statements in the corresponding block to execute.  This
teaches CMake to stop processing commands with a fatal error.  It also
provides context to bad elseif() error messages.
2009-01-20 14:35:22 -05:00
Bill Hoffman e4048118de BUG: fix crash with empty properties 2009-01-18 12:05:45 -05:00
Brad King d602a3db85 BUG: Enforce matching policy PUSH/POP in all files
The documentation of cmake_policy PUSH and POP states that they must
always match.  Previously we enforced this only for the top scope of
each CMakeLists.txt file.  This enforces the requirement for all files.
2009-01-15 14:37:14 -05:00
Brad King 35e391c93b ENH: Provide variable CMAKE_VERSION
This creates the variable CMAKE_VERSION containing the full version of
cmake in "major.minor.patch" format.  It is particularly useful with the
component-wise version comparison provided by the if() command.
2009-01-15 08:57:44 -05:00
Brad King ed3bb743f4 ENH: Improve test property speed with a map
Previously we stored a vector of tests to preserve their order.
Property set/get operations would do a linear search for matching tests.
This uses a map to efficiently look up tests while keeping the original
order with a vector for test file generation.
2009-01-05 15:00:57 -05:00
Bill Hoffman 0c24570ee4 BUG: fix issue with -D and cache force 2008-11-21 16:32:39 -05:00
Brad King 0d425cd501 BUG: Finish fix to old DEFINITIONS property
The cmMakefile::DefineFlagsOrig ivar was created to help preserve the
old DEFINITIONS property behavior now that definitions are moved from
DefineFlags to the COMPILE_DEFINITIONS directory property.  This fixes
propagation of the original value into subdirectories.
2008-10-09 13:52:25 -04:00
Brad King 0ad5eb177b ENH: Return utility target after creation
After creating a utility target with AddUtilityCommand, return a pointer
to the cmTarget instance so the caller may further modify the target as
needed.
2008-10-09 11:00:54 -04:00