Commit Graph

94 Commits

Author SHA1 Message Date
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 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 ecf312ccc8 STYLE: fix line length stuff for KWStyle 2008-10-01 09:04:27 -04:00
Brad King 4fa96dbf95 ENH: Add version comparison to if() command
Provide VERSION_LESS, VERSION_EQUAL, and VERSION_GREATER operators in
the if() command.  This simplifies component-wise comparison of version
numbers in the form "major[.minor[.patch[.tweak]]]".
2008-09-10 11:58:40 -04:00
Brad King fff812db95 ENH: Add if(TARGET) command
It is useful to be able to test if a target has been created.  Often
targets are created only inside conditions.  Rather than storing the
result of the condition manually for testing by other parts of the
project, it is much easier for the other parts to just test for the
target's existence.  This will also be useful when find-modules start
reporting results with IMPORTED targets and projects want to test if a
certain target is available.
2008-08-20 11:45:16 -04:00
Ken Martin 52d8b1b5d9 BUG: fix memory leak and cleanup error string code 2008-06-28 11:16:36 -04:00
Ken Martin 19e891532a ENH: support parenthesis as arguments and in conditionals feature request #6191 2008-06-26 13:01:35 -04:00
Brad King a6a673979d ENH: Add "if(POLICY policy-id)" option for IF command.
- This will help projects support multiple CMake versions.
  - In order to set a policy when using a newer CMake but still
    working with an older CMake one may write
      if(POLICY CMP1234)
        cmake_policy(SET CMP1234 NEW)
      endif(POLICY CMP1234)
  - Note that since CMake 2.4 does not have if(POLICY) supporting
    it will also require using "if(COMMAND cmake_policy)"
2008-03-20 18:25:59 -04:00
Bill Hoffman f48a5cedc9 ENH: fix warnings 2008-02-29 21:33:33 -05:00
Bill Hoffman f386c2aae0 ENH: make CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS the default and remove the property. If any value is specified in an endif, endforeach, endwhile, etc then make sure it matches the start string. If no values are given then it is no longer an error. 2008-02-29 12:18:11 -05:00
Ken Martin 0e69d38004 ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class 2008-01-23 10:28:26 -05:00
Alexander Neundorf 69e9848fb4 BUG: this seems to fix the regexp result-storage problem, now it seems the actual result is tored instead of "1" , as it happened for StringFileTest on Windows
Alex
2007-08-29 14:35:06 -04:00
Alexander Neundorf e80acd971c ENH: also store the group matches from IF( MATCHES) in CMAKE_MATCH_(0..9)
Alex
2007-08-29 11:58:38 -04:00
Alexander Neundorf c9f1af3913 ENH: add IF(IS_ABSOLUTE path), so no regex matching is required in the cmake scripts
Alex
2007-06-06 08:49:18 -04:00
Brad King 9a5b4eba97 BUG: All variable accesses should produce watch callbacks, including IF(DEFINED <var>) ones. Instead we define a new access type for IF(DEFINED) so that the error does not show up for backward compatibility variables. 2007-05-17 17:40:59 -04:00
Brad King b8928b0c8e BUG: Do not complain about missing watched variables when they are accessd with IF(DEFINED VAR). 2007-05-17 15:12:13 -04:00
Ken Martin 372ce05a07 ENH: fix a warning and a nice fix to the IF command 2006-12-12 10:07:20 -05:00
Ken Martin 27379d7b08 ENH: make properties a bit more formal with documentation and chaining 2006-12-07 09:45:32 -05:00
Ken Martin d92f22023c ENH: remove old hack now that project level compatibility files are supported 2006-11-16 15:31:34 -05:00
Brad King b7e04e69ae BUG: It cannot be an error if the values do not convert. The docs say that if the values do not convert the test is false. 2006-10-25 10:57:26 -04:00
Brad King d563ab6677 BUG: For LESS, GREATER, and EQUAL check that the arguments can actually be converted to numbers. Also force the conversion results to be stored in memory to make sure they both use the same precision. This addresses bug#3966. 2006-10-25 10:31:26 -04:00
Brad King b25629efc4 ENH: Remove old IF(FILE_IS_NEWER) syntax. It was never in a release anyway. 2006-10-23 17:14:20 -04:00
Brad King d1a9c93119 ENH: Patch from Alex to provide nicer syntax for FILE_IS_NEWER. Using name IS_NEWER_THAN so old syntax will continue to work. 2006-10-23 13:37:24 -04:00
Ken Martin 5e46232ad8 ENH: added elseif 2006-09-22 11:23:51 -04:00
Brad King 9b89d84210 STYLE: Fixed line-too-long. 2006-08-26 10:29:11 -04:00
Brad King 6449089436 ENH: Patch from Alex for adding IF(FILE_IS_NEWER). I also added a test. 2006-08-25 16:31:07 -04:00
Ken Martin c88c75b8f2 ENH: reduce string construct delete ops 2006-05-31 11:19:39 -04:00
Ken Martin c8c3fff032 COMP: fix warning 2006-05-19 09:36:08 -04:00
Ken Martin 29a03db7ce ENH: allow loose loop constructs 2006-05-18 13:50:01 -04:00
Ken Martin ba2b99bb9f STYLE: fix line length 2006-05-11 15:50:11 -04:00
Bill Hoffman 5a2668b326 ENH: add support for win64 for visual studio 2005 ide and nmake, also fix warnings produced by building for win64 2006-03-30 13:49:56 -05:00
Ken Martin 10efe3b079 ENH: added some new functionality 2006-03-22 14:06:52 -05:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Brad King 84923605cf ENH: Allow IF(DEFINED ENV{somevar}) to work. 2006-02-10 14:41:31 -05:00
Ken Martin fb6d598813 BUG: clean up scoping 2005-11-17 09:44:32 -05:00
Ken Martin 435f4ad8b0 BUG: fix incrementing past end 2005-11-17 09:33:17 -05:00
Ken Martin 7321be8f6d BUG: fix incrementing past end 2005-11-17 09:32:07 -05:00
Ken Martin dec5cc1082 ENH: converted macro to use variables and fixed some case issues with some function blockers 2005-06-23 11:03:57 -04:00
Andy Cedilnik 87cab828b6 ERR: Fix warnings and memory leak 2004-08-04 08:50:37 -04:00
Andy Cedilnik f3e58aeb7d BUG: When regular expression failes to compile, produce error: Fixes part of Bug #1025 - CMake silently ignores regular expression failure 2004-08-03 08:13:54 -04:00
Ken Martin a18fbc3b37 added strequal 2004-06-14 12:02:12 -04:00
Bill Hoffman a014eee86a BUG: fix crash for if statment due to bad microsoft docs on deque BUG id 917 2004-06-11 15:07:17 -04:00
Ken Martin 6c0fb31d50 horrible hack 2004-05-06 09:47:25 -04:00
Ken Martin 1f6e59a7fe fix warning 2004-05-04 09:16:06 -04:00
Ken Martin 0d3bbe8123 minor backwards fix 2004-05-03 15:33:42 -04:00
Ken Martin 50db27739c better if expression support 2004-05-01 10:08:14 -04:00
Bill Hoffman c472345346 BUG: fix logic in EQUAL if test 2004-04-28 09:59:16 -04:00
Bill Hoffman d76c9f8195 ENH: add a numeric EQUAL to the IF statment, very useful for variable arguments in MACROS 2004-04-28 09:51:06 -04:00