Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first). First
run `clang-format` with the config file:
---
SortIncludes: false
...
Commit the result temporarily. Then run `clang-format` again with:
---
SortIncludes: true
IncludeCategories:
- Regex: 'sys/types.h'
Priority: -1
...
Commit the result temporarily. Start a new branch and cherry-pick the
second commit. Manually resolve conflicts to preserve indentation of
re-ordered includes. This cleans up the include ordering without
changing any other style.
Use the following command to run `clang-format`:
$ git ls-files -z -- \
'*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
egrep -z -v '^Source/cm_sha2' |
egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
egrep -z -v '^Utilities/(KW|cm).*/' |
egrep -z -v '^Tests/Module/GenerateExportHeader' |
egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
xargs -0 clang-format -i
This selects source files that do not come from a third-party.
Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
The chaining logic doesn't belong to the container, and the
CMakeInstance pointer doesn't need to be in cmPropertyMap.
Size goes from 56 to 48 bytes with GNU libstdc++-5.1.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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?
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.
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.