Commit Graph

153 Commits

Author SHA1 Message Date
Brad King 6fbd4cae0d Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND"
everywhere.
2015-05-20 11:20:42 -04:00
Stephen Kelly f081c5bddd cmState: Move CacheEntryType enum from cmCacheManager. 2015-04-13 11:44:16 -04:00
Stephen Kelly 77f2807ce5 cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
Being initialized is a requirement for this method to return something,
and is what differentiates it from using GetIterator with it.GetValue.
2015-04-07 23:25:44 +02:00
Brad King d3823263b2 Merge topic 'refactor-cache-api'
3347c5e4 Revert topic 'refactor-cache-api'
2015-04-07 17:15:52 -04:00
Brad King 3347c5e4f9 Revert topic 'refactor-cache-api'
This topic was never tested without some follow-up commits.  The
GetCacheEntryValue API returns a pointer to memory freed on return.
It will have to be revised along with the rest of the original topic.
2015-04-07 17:15:04 -04:00
Brad King 678493d60f Merge topic 'refactor-cache-api'
9410e24a cmCacheManager: Port consumers to non-iterator API.
7b7ae3b1 Port QtDialog to non-iterator cache API.
228c629c Port CursesDialog to non-iterator cache API.
2e50f5e7 cmMakefile: Port away from CacheEntry.Initialized.
e6224367 cmCacheManager: Add non-iterator-based API.
9ada4c04 cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
1fe7f24c Add API for cache loading, deleting and saving to the cmake class.
08c642c6 cmMakefile: Remove cache version accessors.
cec8f97e cmMakefile: Simplify GetDefinitions implementation.
2015-04-07 16:04:05 -04:00
Stephen Kelly 9ada4c0433 cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
Being initialized is a requirement for this method to return something,
and is what differentiates it from using GetIterator with it.GetValue.
2015-04-06 17:58:55 +02:00
Stephen Kelly c22f6c1504 Remove unused includes. 2015-04-06 14:41:05 +02:00
Stephen Kelly c37cf7fa9e cmCacheManager: Remove unused method 2015-04-05 10:26:10 +02:00
Stephen Kelly 64556e3dfa cmCacheManager: Remove unused overloads. 2015-04-05 10:26:10 +02:00
Stephen Kelly 23bb5d225b cmCacheManager: Remove use of intermediate overload. 2015-04-05 10:26:10 +02:00
Stephen Kelly 76207b0861 cmCacheManager: Replace loop with algorithm. 2015-02-20 21:26:18 +01:00
Stephen Kelly fd7b371293 Replace foo.size() pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Brad King 2e953c7657 Merge topic 'fix--D-command-line-parsing'
aee7e4a0 cmCacheManager: parse -D flags more strictly
368e8de4 Tests: test -D parsing on the command line
2014-10-30 14:11:48 -04:00
Ben Boeckel aee7e4a03b cmCacheManager: parse -D flags more strictly
In the case of:

    -DCACHE_VARS=-DEXTERNAL_PROJECT_CMAKE_ARG:BOOL=TRUE

the variable is parsed out as:

    CACHE_VARS=-DEXTERNAL_PROJECT_CMAKE_ARG

because the parser allows '=' in the variable name. Disallow such a name
on the command line.
2014-10-20 12:17:19 -04:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Brad King af34639724 Merge topic 'fix-cache-self-assignment'
1cd37527 cmCacheManager: Avoid cache entry self-assignment
326d15a3 cmake: Tolerate missing HELPSTRING on compiler change
2014-05-28 12:34:30 -04:00
Brad King 1cd3752729 cmCacheManager: Avoid cache entry self-assignment
Since commit bef93dc5 (Couple of changes: cache variables now have a map
of properties, 2002-09-11) the cmCacheManager::AddCacheDefinition method
accesses its map entry by reference.  However, the commit left the
original entry assignment at the end of the method.  With Apple Clang
5.1 and libc++ this self-assignment destroys the cache entry property
map.

Drop the self assignment.  Also drop the condition around the call to
UnwatchUnusedCli since it was a self-comparison that must always have
been true.
2014-05-27 16:12:05 -04:00
Stephen Kelly af8a1643c1 Remove c_str calls when using stream APIs.
Use an ad-hoc clang tool for matching the calls which should be
ported.
2014-03-11 15:03:50 +01:00
Ben Boeckel b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Ben Boeckel f3efa3cd16 stringapi: Use strings for cache paths as arguments 2014-03-08 13:05:32 -05:00
Ben Boeckel 3742bb0d32 stringapi: Use strings for variable names
Variable names are always generated by CMake and should never be NULL.
2014-03-08 13:05:28 -05:00
Ben Boeckel ec97ed7d0c stringapi: Use strings for property names
Property names are always generated by CMake and should never be NULL.
2014-03-08 13:05:28 -05:00
Brad King d2059d2511 cmVersion: Fix CMake_VERSION_ENCODE for date in patch level
Use a uint64_t to store encoded version numbers so we have plenty of
bits available.  Encode with room for up to 1000 minor releases between
major releases and to encode dates until the year 10000 in the patch
level.  This is necessary because CMake development versions prior to
release 2.8.0 used the date in the patch level, and this practice may be
restored after the 3.0 release.
2014-02-10 15:32:32 -05:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Brad King 399e9c46d8 Drop builtin property documentation
Drop all DefineProperty calls for non-chained properties.  Drop the
documentation from the chained ones.  The documentation for all
properties is now in Help/prop_*/*.rst files.
2013-10-16 09:22:36 -04:00
Stephen Kelly 273ecab96d CLI: Suppress the unused warning if the key value pair is cached.
It is common to specify a CMAKE_TOOLCHAIN_FILE and get a warning
for using it despite it not being used.

The WarnUnusedCliUnused test relies on the warning being emitted
each time cmake is run on an existing build. That behavior is changed
by this patch to warn only on the first invokation of CMake, and not
on subsequent invokations (because the variable is in the cache with
the same value). For that test, a clean target is added which clears
the cache and cause the warning to be emitted each time.

As the Ninja generator does not support the feature needed to test
this, it is not tested with that generator.
2013-06-04 12:38:56 +02:00
Andreas Mohr ddac8d3d2d Fix spelling and typos (affecting binary data / module messages) 2013-05-07 08:39:19 -04:00
Brad King 1df09e5773 Delete entire CMakeFiles directory when deleting CMakeCache.txt (#13756)
Since commit e015df7d (...delete CMakeFiles directory when cache is
deleted, 2006-02-20) we deleted the files in the CMakeFiles directory
when deleting CMakeCache.txt in order to reset the build tree to a fresh
state.  This allowed commit fd33bf93 (fix for bug 6102, allow users to
change the compiler, 2007-12-13) to delete CMakeCache.txt when the user
changes the compiler and CMakeFiles/CMake<lang>Compiler.cmake and other
platform information files would go with it to allow a fresh start.

Then commit 7195aca5 (Make platform information files specific to the
CMake version, 2012-08-24) moved the platform information files to a
subdirectory e.g. CMakeFiles/<version>/CMake<lang>Compiler.cmake where
<version> is the current CMake version.  This causes the compiler change
logic to fail to remove all old compiler information.  Then on the next
configuration CMake<lang>Compiler.cmake would set CMAKE_<lang>_COMPILER
back to the old value and re-trigger the compiler change logic.  This
causes an infinite loop of cache deletion and compiler reset.

Fix this simply by teaching cmCacheManager::DeleteCache to remove the
entire CMakeFiles directory recursively whenever it removes an existing
CMakeCache.txt.  This fully resets the build tree to configure with a
fresh compiler.
2013-02-18 09:58:34 -05: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 9eb8e4b22b Write CMakeCache.txt atomically (#13040)
The write code introduced by commit 0b0d1b1d (add CMakeCache.txt
support, 2001-02-22) uses a temporary file but does not replace the
original atomically.  Use cmGeneratedFileStream to do both
copy-if-different and atomic replacement.
2012-03-14 08:18:15 -04:00
Alex Neundorf 9dbba1b464 Fix #12342: Add APPEND_STRING option to set_property()
set_property() has APPEND, which creates a list. E.g. when
appending to COMPILE_FLAGS a string is needed, not a list.
With the APPEND_STRING option the value is append as string,
not as list.

Alex
2011-07-15 20:57:33 +02:00
David Cole a2a997d8c4 Correct misspelling in error message text. 2010-12-06 08:44:26 -05:00
Ben Boeckel 8b143fab66 Condense parsing of cache entries
If a cache line is being parsed, it shouldn't matter whether it has a
type or not; just parse it however possible.
2010-11-22 15:45:30 -05:00
Ben Boeckel 122ebf1297 Support manual cache entries 2010-11-22 15:17:51 -05:00
Ben Boeckel 6fe8624b7f Fix parsing of cache variables without a type
These mainly come from the command line or manual entries in the
CMakeCache.txt file. We want to stop at the first '=' because this is
what is most likely to have been meant. The variable can be quoted if
the '=' is intended.

Caveat: What if one wants both '"' and '=' in a variable name?
2010-11-22 15:12:47 -05:00
Brad King 8779559dd5 Remove unused #include <windows.h> 2010-01-13 13:49:08 -05: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 74b79d3b39 Remove barely-used cmCacheManager::AddCacheEntry
The commit "Remove barely-used cmMakefile::AddCacheDefinition" removed
all but one use of the cmCacheManager method 'bool' overload.  This
commit removes the other use and the entire method, thus reducing code
duplication.
2009-09-11 10:04:10 -04:00
Brad King 5cde305b99 BUG: Document internal cache property MODIFIED
All cmake-defined properties should be documented, even if they are
internal.  This fixes the DocTest when CMAKE_STRICT is enabled.
2009-03-13 10:53:53 -04:00
Brad King 5e49dc4346 BUG: Fix cache properties for CMAKE_STRICT build
All cmPropertyMap instances must have CMakeInstance set.  This teaches
cmCacheManager to set it on cache entries.
2009-03-13 10:53:47 -04:00
Brad King d96e7e0e5a COMP: Do not use void returns
VS 6 does not support the C++ void returns feature.  This removes an
accidental use of it.
2009-03-12 13:11:48 -04:00
Brad King dd7b48c9c3 ENH: Define STRINGS cache entry property
This property defines a list of values for a cache entry of type STRING.
A CMake GUI may optionally use a drop-down selection widget for the
entry instead of a generic text entry field.  We do not enforce that the
value of the entry match one of the strings listed.
2009-03-12 10:52:40 -04:00
Brad King 1b43bea91c ENH: Refactor cache entry writing and reading
This factors out duplicated code into reusable methods, thus simplifying
writing and reading of cache entry help strings, keys, values, and
properties.
2009-03-12 10:49:05 -04:00
Brad King 32258b44bc ENH: Document CACHE entry properties
This adds a property documentation section for CACHE properties.
We document the ADVANCED, HELPSTRING, TYPE, and VALUE properties.
2009-03-10 11:11:15 -04:00
Brad King e5e91d6179 ENH: Teach set/get_property about CACHE properties
This adds the CACHE option to set_property and get_property commands.
This allows full control over cache entry information, so advanced users
can tweak their project cache as desired.  The set_property command
allows only pre-defined CACHE properties to be set since others would
not persist anyway.
2009-03-10 11:10:59 -04:00
Brad King ca9fb4826f ENH: Use cmPropertyMap for cache properties
This re-implements cache entry property storage in cmCacheManager to use
cmPropertyMap so it can share the standard property implementation.
2009-03-10 11:10:42 -04:00
Brad King 98c51ff6dc ENH: Overhaul CMake version numbering
This moves the version numbers into an isolated configured header so
that not all of CMake needs to rebuild when the version changes.

Previously we had spaces, dashes and/or the word 'patch' randomly chosen
before the patch number.  Now we always report version numbers in the
traditional format "<major>.<minor>.<patch>[-rc<rc>]".

We still use odd minor numbers for development versions.  Now we also
use the CCYYMMDD date as the patch number of development versions, thus
allowing tests for exact CMake versions.
2009-03-05 15:17:07 -05:00