Commit Graph

71 Commits

Author SHA1 Message Date
Stephen Kelly d2475bb5c4 cmListFileBacktrace: Implement in terms of cmState::Snapshot.
Avoid copying many strings into each backtrace object.
2015-07-06 11:22:42 -04:00
Stephen Kelly 238aac2351 cmListFile: Remove FilePath member from cmListFileContext.
There is no need to store the FilePath for every function, as it is
known by other means.
2015-07-06 11:22:41 -04:00
Stephen Kelly 782657db48 cmListFileArgument: Remove FilePath member.
It is now unused.
2015-06-21 20:57:26 +02:00
Stephen Kelly 242dcc2c22 cmListFileBacktrace: Replace local generator with cmState::Snapshot.
Construct cmOutputConverter only when needed.
2015-06-06 09:15:57 +02:00
Stephen Kelly 499ebb6564 cmListFileBacktrace: Internalize the step of making paths relative.
Currently cmMakefile calls MakeRelative on a copy of the backtrace,
emits the copy to the stream once, then discards the copy.  There
is no need to have API for the path conversion.
2015-06-03 01:04:00 +02:00
Stephen Kelly 61d52e6e77 cmListFileBacktrace: Hide the context-stack implementation detail.
The backtrace will soon not be implemented in terms of a stack of
cmListFileContext objects.  Keep the cmListFileContext in the API
for convenience for now.
2015-05-18 23:56:00 +02:00
Stephen Kelly 9645cba3bf cmListFileContext: Implement EqualityComparable. 2015-05-18 23:55:44 +02:00
Stephen Kelly 18f810a865 cmListFileContext: Sort by line before file.
This should be much faster.  In the context where it is used the
line comparison should be sufficient, removing the need to compare
files at all.
2015-05-18 23:55:43 +02:00
Stephen Kelly e96b5d14f9 cmListFileContext: Implement LessThanComparable.
Move wrapping existing code from cmMakefile, and simplify the
implementation there.
2015-05-18 23:55:43 +02:00
Stephen Kelly 257c16495a cmListFile: Remove unused member.
It is written, but not read since commit v2.4.0~575 (ENH: Since list file
cache does not make much sense any more ..., 2006-02-07).
2015-04-04 18:31:03 +02:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Stephen Kelly 2db55ffa56 Remove borland workarounds.
CMake 3.0 is the last release to require to be able to build with
Borland.
2014-10-15 23:16:44 +02:00
Brad King b1c113d9a7 cmake: Do not open directories as scripts (#14966)
Check if a file path is a directory before opening it.  Extend the
RunCMake.CommandLine test with a case running "cmake -P" on a directory.
2014-06-09 16:21:11 -04:00
Ben Boeckel 2a1b2d8486 backtrace: Convert to local paths in IssueMessage
This is the only place we care show the FilePath to the user, so defer
the expensive relative path calculation until here.
2014-06-05 12:44:19 -04:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Brad King daa0f6f98d Add Lua-style long brackets and long comments to CMake language
Teach the CMake language parser to recognize Lua-style "long bracket"
arguments.  These start with two '[' separated by zero or more '='
characters e.g. "[[" or "[=[" or "[==[".  They end with two ']'
separated by the same number of '=' as the opening bracket.  There is no
nesting of brackets of the same level (number of '=').  No escapes,
variable expansion, or other processing is performed on the content
between such brackets so they always represent exactly one argument.

Also teach CMake to parse and ignore "long comment" syntax.  A long
comment starts with "#" immediately followed by an opening long bracket.
It ends at the matching close long bracket.

Teach the RunCMake.Syntax test to cover long bracket and long comment
cases.
2013-10-17 09:07:00 -04:00
Brad King dbd933365e cmListFileLexer: Allow a leading UTF-8 Byte-Order-Mark (#11137)
Teach the lexer to read a UTF-8, UTF-16 BE/LE, or UTF-32 BE/LE
Byte-Order-Mark from the start of a file if any is present.  Report an
error on files using UTF-16 or UTF-32 and accept a UTF-8 or missing BOM.
2013-10-17 09:06:59 -04:00
Brad King 9040ec9117 Do not warn about left paren not separated by a space
Since commit 58e52416 (Warn about arguments not separated by whitespace,
2013-02-16) we warn about arguments not separated by spaces.  Loosen the
warning to not complain about left parens not separated by spaces from
the preceding token.  This is common in code like "if(NOT(X))".

Teach the RunCMake.Syntax test to cover cases of left parens not
separated by spaces and check that no warning appears.
2013-08-15 09:00:34 -04:00
Brad King bf73264694 Warn about unquoted arguments that look like long brackets
In the future CMake will introduce Lua-style long bracket syntax.
Warn about unquoted arguments that in the future will be treated
as opening long brackets.

Teach the RunCMake.Syntax test to cover such cases and ensure that the
warning appears.
2013-08-08 13:26:28 -04:00
Brad King 58e524165d Warn about arguments not separated by whitespace
Teach the lexer to return tokens for whitespace.  Teach the parser to
tolerate the space tokens where whitespace is allowed.  Also teach the
parser to diagnose and warn about cases of quoted arguments followed
immediately by another argument.  This was accidentally allowed
previously, so we only warn.

Update the RunCMake.Syntax test case StringNoSpace expected stderr to
include the warnings.
2013-08-08 13:26:27 -04:00
Brad King e75b69f55b cmListFileCache: Convert CMake language parser to class
Refactor the parser implementation into a class to make
it easier to extend.
2013-08-08 13:26:27 -04:00
Brad King 0546484e4b cmListFileArgument: Generalize 'Quoted' bool to 'Delimeter' enum
Replace the boolean value that indicates whether an argument is unquoted
or quoted with a generalized enumeration of possible argument types.
For now "Quoted" and "Unquoted" remain the only types.
2013-08-08 13:26:27 -04:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -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
Ken Martin 19e891532a ENH: support parenthesis as arguments and in conditionals feature request #6191 2008-06-26 13:01:35 -04:00
Alexander Neundorf 05f84cb091 ENH: write the cmake version into the file created by EXPORT_LIBRARY_DEPENDENCIES()
to help with debugging later on. The same should be done in the import
target files (but I didn't have time to do it yet).
STYLE: fix line length in cmListFileCache.cxx

Alex
2008-04-27 07:01:05 -04:00
Brad King e3666a1de5 ENH: Allow policy CMP0000 to be set explicitly
- Message for missing cmake_minimum_required is not issued
    until the end of processing the top CMakeLists.txt file
  - During processing a cmake_policy command may set behavior
  - OLD behavior is to silently ignore the problem
  - NEW behavior is to issue an error instead of a warning
2008-03-31 13:33:09 -04:00
Ken Martin 66a8c5763b ENH: tiny performance improvement 2008-03-20 10:46:24 -04:00
Ken Martin a568a8552d ENH: small simple projects do not need to specify cmake minimum required 2008-03-20 10:40:24 -04:00
Brad King 01033b5d56 ENH: Improve warning about specifying a cmake version
- Update policy CMP0000 to require use of the command
    cmake_minimum_required and not cmake_policy
    so there is only one way to avoid it.
  - Explicitly specify the line users should add.
  - Reference policy CMP0000 only at the end.
  - Fix policy CMP0000 documentation to not suggest
    use of the cmake_policy command.
2008-03-19 15:18:21 -04:00
Brad King f7f03347a6 ENH: Improve new error/warning message generation
- Add cmListFileBacktrace to record stack traces
  - Move main IssueMessage method to the cmake class instance
    (make the backtrace an explicit argument)
  - Change cmMakefile::IssueMessage to construct a backtrace
    and call the cmake instance version
  - Record a backtrace at the point a target is created
    (useful later for messages issued by generators)
2008-03-13 13:48:57 -04:00
Ken Martin 73df9a5cd4 ENH: change CMP_ to CMP 2008-03-13 11:38:46 -04:00
Bill Hoffman dc9245df6c ENH: add enum to IssueMessage 2008-03-11 10:29:56 -04:00
Brad King 5233b75a77 ENH: Improve handling of old-style compatibility.
- Remove CMP_0001 (no slash in target name) and restore
    old CMAKE_BACKWARDS_COMPATIBILITY check for it
  - Replace all checks of CMAKE_BACKWARDS_COMPATIBILITY
    with cmLocalGenerator::NeedBackwardsCompatibility calls
  - Create new CMP_0001 to determine whether or not
    CMAKE_BACKWARDS_COMPATIBILITY is used.
    (old = use, new = ignore)
  - Show CMAKE_BACKWARDS_COMPATIBILITY in cache only when
    CMP_0001 is set to OLD or WARN
  - Update documentation of cmake_policy and cmake_minimum_required
    to indicate their relationship and the 2.4 version boundary
  - When no cmake policy version is set in top level makefile
    implicitly call cmake_policy(VERSION 2.4) which restores
    CMAKE_BACKWARDS_COMPATIBILITY and other 2.4 compatibility
  - Fix tests MakeClean and Preprocess to call
    cmake_policy(VERSION 2.6) because they depend on new policies
2008-03-07 15:30:35 -05:00
Ken Martin 55eede4b13 ENH: clean up some policy stuff and interactions with CMAKE_BACKWARDS_COMPATIBILITY and CMAKE_MINIMUM_REQUIRED 2008-03-07 11:43:47 -05:00
Ken Martin 3b7eaad890 STYLE: fix line length issue 2008-03-07 09:41:14 -05:00
Brad King 680104a490 ENH: New format for warning and error messages
- Add cmMakefile methods IssueError and IssueWarning
  - Maintain an explicit call stack in cmMakefile
  - Include context/call-stack info in messages
  - Nested errors now unwind the call stack
  - Use new mechanism for policy warnings and errors
  - Improve policy error message
  - Include cmExecutionStatus pointer in call stack
    so that errors deeper in the C++ stack under
    a command invocation will become errors for the
    command
2008-03-07 08:40:36 -05:00
Ken Martin 3518c08a8d BUG: keep CMAKE_BACKWARDS_COMP as internal 2008-03-06 16:03:48 -05:00
Ken Martin afd8448d0d BUG: make default CMAKE_BACKWARDS_COMPATIBILITY 2.5 2008-03-06 15:51:51 -05:00
Ken Martin 5588ed47fc BUG: change in handling of cmake_minimum_required 2008-03-06 15:08:03 -05:00
Ken Martin adddcea5d7 BUG: change the handling of CMAKE_MINIMUM_REQUIRED and BACKWARDS_COMPATIBILITY and extend the documentaiton quite a bit 2008-03-06 10:57:59 -05:00
Brad King 9b0df0d692 BUG: ParseFile should return false if there was a parse error. 2007-11-19 13:42:05 -05:00
Brad King ab61137eb1 COMP: Fix and/or disable warnings for Borland 5.6 build. 2006-08-01 11:38:42 -04:00
Ken Martin 7dc8a92246 STYLE: fix line length 2006-05-12 11:56:09 -04:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Andy Cedilnik 892a439fad BUG: Remove some old legacy code and remove memory leak 2006-03-08 10:52:29 -05:00
Andy Cedilnik 4259971961 ENH: Since list file cache does not make much sense any more (because of proper list file parsing), and it actually adds unnecessary complications and make ctest scripting not work, take it out 2006-02-07 08:49:42 -05:00
Ken Martin 5aad7d13cb BUG: project command should also work with lower case 2005-07-06 15:25:05 -04:00
Andy Cedilnik 1bbccc5bef ENH: Improve handling of escaped characters 2005-06-17 15:50:08 -04:00
Brad King c5756a41d3 BUG: Fixed line number of end of file error message. 2004-08-31 18:51:35 -04:00