Commit Graph

61 Commits

Author SHA1 Message Date
Daniel Pfeifer 516f8edb2e Avoid else after return 2016-09-16 22:45:24 +02:00
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King 0ac18d40c8 Remove `//------...` horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -04:00
Brad King 180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -04:00
Brad King 31e6571cca find_program: Fix regression in finding an already-known path
Changes in commit v3.4.0-rc1~124^2~1 (cmFindProgramCommand: Re-implement
search using more flexible approach, 2015-09-01) did not preserve the
behavior of looking for the given name with no search path at all.
Fix this and add a test case covering finding an absolute path with
no search directories.
2015-10-30 07:40:46 -04:00
Brad King 8ea7611bc3 find_program: Optionally consider all names in each directory
When more than one value is given to the NAMES option this command by
default will consider one name at a time and search every directory for
it.  Add a NAMES_PER_DIR option to tell this command to consider one
directory at a time and search for all names in it.
2015-09-02 10:17:22 -04:00
Brad King fc1990c933 cmFindProgramCommand: Re-implement search using more flexible approach
Avoid using KWSys SystemTools::FindProgram because it does much more
than we actually need for find_program and does not allow us to control
the order of preference between directories and names.  Create our own
cmFindProgramHelper much like cmFindLibraryHelper but without all the
find_library-specific parts.
2015-09-02 10:17:22 -04:00
Brad King ed4de3c984 cmFindProgramCommand: Use Names member instead of passing it 2015-09-02 10:17:21 -04:00
Stephen Kelly f081c5bddd cmState: Move CacheEntryType enum from cmCacheManager. 2015-04-13 11:44:16 -04:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01: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
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 e33d8d2d77 Drop builtin command documentation
Drop all GetTerseDocumentation and GetFullDocumentation methods from
commands.  The command documentation is now in Help/command/*.rst files.
2013-10-16 09:22:36 -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
Bjoern Ricks 0d2f5c8d6a Fix crash if app bundle executeable couldn't be found
Fix a crash on Mac OS X if a programm can't be found as an
application bundle. CFRelease MUST NOT be called on a
NULL value.

See https://developer.apple.com/library/mac/documentation/CoreFOundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/doc/c_ref/CFRelease
2012-02-25 18:20:36 +01:00
Brad King b41ad3b399 Teach find_(library|package) about Linux multiarch (#12037)
Implement support for multiarch as specified here:

  http://wiki.debian.org/Multiarch
  https://wiki.ubuntu.com/MultiarchSpec

Detect the <arch> part of <prefix>/lib/<arch> from the implicit library
search path from each compiler to set CMAKE_<lang>_LIBRARY_ARCHITECTURE.
Define CMAKE_LIBRARY_ARCHITECTURE using one of these values (they should
all be the same).  Teach the find_library and find_package commands to
search <prefix>/lib/<arch> whenever they would search <prefix>/lib.
2011-06-08 10:04:44 -04:00
Brad King 5303fbf09e Speedup find_* commands (#11412)
Delay computation of the command documentation until it is needed.
It is wasteful to do it in the constructor on every call.

Inspired-By: Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
2010-11-12 10:47:28 -05: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 6706f84cd9 ENH: Refactor find_* command framework/appbundle search order impl.
- CMAKE_FIND_FRAMEWORK and CMAKE_FIND_APPBUNDLE are supposed to specify
    whether to find frameworks/appbundles FIRST, LAST, ONLY, or NEVER.
  - Previously this affected only the placement of CMAKE_FRAMEWORK_PATH
    and CMAKE_APPBUNDLE_PATH with respect to the other path specifiers.
  - Now it behaves as documented.  The entire search path is inspected for
    each kind of program, library, or header before trying the next kind.
  - Additionally the ONLY mode is now honored for headers so that users
    do not end up with a library in framework and a header from elsewhere.
2008-06-09 11:58:29 -04: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
Brad King b424df917d ENH: Major improvements to the FIND_PACKAGE command. See bug #3659.
- Use CMAKE_PREFIX_PATH and CMAKE_SYSTEM_PREFIX_PATH among other means
    to locate package configuration files.
  - Create cmFindCommon as base for cmFindBase and cmFindPackageCommand
  - Move common functionality up to cmFindCommon
  - Improve documentation of FIND_* commands.
  - Fix FIND_* commands to not add framework/app paths in wrong place.
2008-01-17 09:02:31 -05:00
Alexander Neundorf 0398d8ad38 ENH: add support for CMAKE_FIND_PREFIX_PATH as discussed with Brad.
CMAKE_FIND_PREFIX_PATH is both an environment variable and a cmake variable,
which is a list of base directories where FIND_PATH, FIND_FILE, FIND_PROGRAM
and FIND_LIBRARY will search in the respective subdirectories

Alex
2007-10-26 09:55:40 -04:00
Ken Martin 8d32d229a3 ENH: make commands lower case by default 2007-10-10 11:47:43 -04:00
Alexander Neundorf 0ddc9f62e5 ENH: add cmExternalMakefileProjectGenerator, which should make it easier to
write generators for IDE projects, which use already existing makefiles
(current the kdevelop generator)
-first stept of the export interface, iniitial export() command
-more replacements for the FIND_XXX docs

Alex
2007-06-08 11:57:16 -04:00
Brad King ec637248da BUG: If the user specifies a cache entry on the command line without a type, the FIND_* commands should add the type and docstring to the given value and put it back in the cache. 2006-07-18 15:21:26 -04:00
Ken Martin 2af4710525 STYLE: fix line length 2006-05-10 15:46:45 -04:00
Bill Hoffman 1871a74153 ENH: fix warning 2006-04-13 23:24:09 -04:00
Bill Hoffman cae4e6b37a ENH: add patch for finding applications on OSX 2006-04-13 11:00:52 -04:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Bill Hoffman e97157feb1 ENH: make sure system path is not added unless asked for 2006-03-08 18:16:01 -05:00
Bill Hoffman a5825cd11a ENH: check in new find stuff 2006-03-02 13:30:22 -05:00
Ken Martin 072db6ad70 removed redundent includes 2003-08-10 18:30:54 -04:00
Bill Hoffman f58d7df66a ENH: add checking for NOTFOUND 2003-01-31 13:50:42 -05:00
Brad King 4888c088ae ENH: Moved ExpandListVariables out of individual commands. Argument evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside. 2002-12-11 18:13:33 -05:00
Brad King 1f6a3c67b1 ENH: Added reference to Copyright.txt. Removed old reference to ITK copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs. 2002-10-23 18:03:27 -04:00
Andy Cedilnik c3007233ec Rename variables to remove warnings 2002-10-17 10:51:23 -04:00
Andy Cedilnik bef93dc5c1 Couple of changes: cache variables now have a map of properties. ADVANCED and HELPSTRING are now properties of cache variable, IsAdvanced is gone, so is GetCacheEntry, since cache entries are now all private. To access them, you use the iterator. -ADVANCED cache entries are gone and are replaced by the property of cache variables. The cache file still looks the same, but the -ADVANCED cache entries are created when writing file. MarkAsAdvanced and VariableRequires are fixed. So are curses gui and wizard 2002-09-11 14:05:45 -04:00
Ken Martin d0be2896d7 changed cache manager and registered generators to no longer be singletons 2002-08-28 14:51:10 -04:00
Sebastien Barre 1ad05f9e6d ENH/FIX: add NO_SYSTEM_PATH option + fix command usage 2002-05-12 11:31:45 -04:00
Bill Hoffman 7d76de4403 make sure ; expansion is done in all commands 2002-03-29 14:20:32 -05:00
Bill Hoffman 809b32fe59 ENH: remove several compiler warnings 2002-03-13 10:25:11 -05:00
Bill Hoffman 4651dbcfc6 ENH: expand variables in arguments before the commands get them 2002-03-05 18:41:24 -05:00
Will Schroeder a6a43d5320 ENH:Updated copyright 2002-01-21 15:30:43 -05:00
Berk Geveci e452849640 FIX: Entry doc. should never be overwritten. This may cause cmake to be re-run very often. 2002-01-15 13:20:22 -05:00
Bill Hoffman 3e24edcd04 ENH: add possibility to add doc strings to varibles created by find type commands 2001-11-26 18:24:47 -05:00
Bill Hoffman baa28efd10 ENH: change InitialPass to take a const reference to the argument string, to avoid changes to the file cache 2001-09-20 15:08:30 -04:00
Brad King 65ef85320a ENH: Added cmSystemTools::GlobDirs function to allow wildcards in paths (like /foo/bar/*). 2001-09-20 10:54:29 -04:00
Bill Hoffman db1303aa7d ENH: big change, only allow commands access to the cache via the cmMakefile class and GetDefinition, also the cmMakefile is the only way for commands to add to the cache. Also, some changes to configure.in that check for for scoping 2001-08-08 11:54:46 -04:00
Bill Hoffman 9922155423 ENH: rename Invoke to InitialPass 2001-06-06 13:19:15 -04:00
Ken Martin dbfc72c6b5 expands reg values 2001-05-11 11:07:05 -04:00