Commit Graph

51 Commits

Author SHA1 Message Date
Stephen Kelly
bd990c803b Remove use of ExpandSourceListArguments.
By now, it is only an expensive copy.
2015-02-05 20:44:25 +01: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
Brad King
e15a7075b5 Add an option for explicit BYPRODUCTS of custom commands (#14963)
A common idiom in CMake-based build systems is to have custom commands
that generate files not listed explicitly as outputs so that these
files do not have to be newer than the inputs.  The file modification
times of such "byproducts" are updated only when their content changes.
Then other build rules can depend on the byproducts explicitly so that
their dependents rebuild when the content of the original byproducts
really does change.

This "undeclared byproduct" approach is necessary for Makefile, VS, and
Xcode build tools because if a byproduct were listed as an output of a
rule then the rule would always rerun when the input is newer than the
byproduct but the byproduct may never be updated.

Ninja solves this problem by offering a 'restat' feature to check
whether an output was really modified after running a rule and tracking
the fact that it is up to date separately from its timestamp.  However,
Ninja also stats all dependencies up front and will only restat files
that are listed as outputs of rules with the 'restat' option enabled.
Therefore an undeclared byproduct that does not exist at the start of
the build will be considered missing and the build will fail even if
other dependencies would cause the byproduct to be available before its
dependents build.

CMake works around this limitation by adding 'phony' build rules for
custom command dependencies in the build tree that do not have any
explicit specification of what produces them.  This is not optimal
because it prevents Ninja from reporting an error when an input to a
rule really is missing.  A better approach is to allow projects to
explicitly specify the byproducts of their custom commands so that no
phony rules are needed for them.  In order to work with the non-Ninja
generators, the byproducts must be known separately from the outputs.

Add a new "BYPRODUCTS" option to the add_custom_command and
add_custom_target commands to specify byproducts explicitly.  Teach the
Ninja generator to specify byproducts as outputs of the custom commands.
In the case of POST_BUILD, PRE_LINK, and PRE_BUILD events on targets
that link, the byproducts must be specified as outputs of the link rule
that runs the commands.  Activate 'restat' for such rules so that Ninja
knows it needs to check the byproducts, but not for link rules that have
no byproducts.
2014-11-14 16:16:00 -05: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
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
Daniel R. Gomez
a4cba0e8be Fix plugin API for gcc 2.9-aix51-020209 (#12233)
Use proper C function prototype syntax to satisfy this compiler.
2011-05-31 09:08:59 -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
921f3a1ac2 BUG: Do not automatically set HEADER_FILE_ONLY
Long ago the native build system generators needed HEADER_FILE_ONLY to
be set on header files to stop them from building.  The modern
generators correctly handle headers without the help of this property.
This removes automatic setting of the property so that it can be used
reliably as an indicator of project author intention.  It fixes VS IDE
project files to show header files normally instead of excluded (broken
by the fix for issue #7845).
2009-03-16 14:30:24 -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
Ken Martin
e4ac63fa72 BUG: better setup of properties for loaded commands 2007-11-12 12:04:36 -05:00
Alexander Neundorf
f7d4f27c2a ENH: add IMPORT keyword to ADD_LIBRARY, dependencies are not yet working
STYLE: fix line lengths and indentation, use enum as argument to AddLibrary() instead of int (which was initialized from a bool in some cases)

Alex
2007-06-22 09:58:10 -04:00
Brad King
f786f3ae32 COMP: Work-around warning about static specifier on HP compiler. 2007-06-19 09:18:22 -04:00
Brad King
35936433e1 ENH: Merging changes from branch CMake-SourceFile2-b between tags
CMake-SourceFile2-bp and CMake-SourceFile2-b-mp1 to trunk.  This
commit is surrounded by tags CMake-SourceFile2-b-mp1-pre and
CMake-SourceFile2-b-mp1-post on the trunk.

The changes re-implement cmSourceFile and the use of it to allow
instances to be created much earlier.  The use of cmSourceFileLocation
allows locating a source file referenced by a user to be much simpler
and more robust.  The two SetName methods are no longer needed so some
duplicate code has been removed.  The strange "SourceName" stuff is
gone.  Code that created cmSourceFile instances on the stack and then
sent them to cmMakefile::AddSource has been simplified and converted
to getting cmSourceFile instances from cmMakefile.  The CPluginAPI has
preserved the old API through a compatibility interface.

Source lists are gone.  Targets now get real instances of cmSourceFile
right away instead of storing a list of strings until the final pass.

TraceVSDependencies has been re-written to avoid the use of
SourceName.  It is now called TraceDependencies since it is not just
for VS.  It is now implemented with a helper object which makes the
code simpler.
2007-06-18 11:59:23 -04:00
Brad King
ba8ec0d5cf ENH: Made cmSourceFile::GetDepends return reference to const so dependencies can be added only by an access method in cmSourceFile. 2007-05-28 10:11:44 -04:00
Ken Martin
c53b26baf2 ENH: some more cleanup 2007-03-13 15:18:27 -04:00
Ken Martin
5d11564c35 ENH: allow source file properties to chain to Directories and up 2006-12-13 12:19:59 -05:00
Ken Martin
ba75d1e823 COMP: fix warning 2006-12-07 09:51:28 -05:00
Ken Martin
27379d7b08 ENH: make properties a bit more formal with documentation and chaining 2006-12-07 09:45:32 -05:00
Bill Hoffman
ccb77b65c6 ENH: unify version stuff, get rid of it out of cmake and cmMakefile and only use cmVersion 2006-11-29 15:59:16 -05:00
Brad King
7d2de52c1a ENH: Cleaned up signature of cmMakefile::AddUtilityCommand. It is not valid to have an output from a utility rule and no calls to the method asked for an output anyway. The argument has been removed. 2006-09-28 13:55:26 -04:00
Brad King
658d38e0af COMP: Added missing includes. This partially addresses bug#3556. 2006-08-01 14:31:24 -04:00
Ken Martin
3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Andy Cedilnik
634343c3e8 STYLE: Fix some style issues 2006-03-10 13:06:26 -05:00
Bill Hoffman
347c5f4b46 ENH: add working directory support 2006-02-08 10:58:36 -05:00
Bill Hoffman
9891260a6d ENH: add support for watcom wmake and wcl386 2006-01-17 10:21:45 -05:00
Brad King
39af9ee1e4 ENH: Updated implementation of custom commands. Multiple command lines are now supported effectively allowing entire scripts to be written. Also removed extra variable expansions and cleaned up passing of commands through to the generators. The command and individual arguments are now kept separate all the way until the generator writes them out. This cleans up alot of escaping issues. 2005-02-22 10:32:44 -05:00
Brad King
b6da1d1271 ENH: Added support for special variables CMAKE_CURRENT_LIST_FILE and CMAKE_CURRENT_LIST_LINE that evaluate to the file name and line number in which they appear. This implements the feature request from bug 1012. 2004-08-04 10:45:11 -04:00
Andy Cedilnik
b1a7421840 ENH: Styart working on bundles support and abstract WIN32_EXECUTABLE 2004-02-28 18:59:19 -05:00
Andy Cedilnik
2ccce878a3 ENH: Cleanups 2004-02-22 13:14:59 -05:00
Andy Cedilnik
e093bdade0 ENH: Fix compatibility 2003-07-23 14:31:30 -04:00
Andy Cedilnik
7eb7973393 ERR: Fix error on bad C++ compiler that do not handle return void 2003-07-22 13:53:06 -04:00
Andy Cedilnik
8327883f3f ENH: Add DisplayStatus 2003-07-22 13:14:55 -04:00
Ken Martin
ba68f771b3 yikes added new custom command support 2003-06-03 10:30:23 -04:00
Brad King
10931b5e66 ENH: Added return type int to ExecuteCommand. 2002-12-17 17:05:59 -05:00
Ken Martin
ad8504701e fixed warnings 2002-12-13 09:27:31 -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
Ken Martin
c3474d4257 added a Free method 2002-12-11 14:16:55 -05:00
Ken Martin
f67643112c added another func 2002-11-14 11:16:58 -05:00
Ken Martin
1d74cb3e35 added another func 2002-11-14 11:03:08 -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
Ken Martin
abf3337888 some mods to the plugin API 2002-10-08 15:55:04 -04:00
Brad King
ce65c54d7a ERR: Fixes for comeau compiler. NULL is a pointer of type void*, and cannot be compared directly with other pointer types. We use 0 instead. 2002-09-10 15:39:18 -04:00
Ken Martin
b64c6bba11 extern C fixes 2002-08-29 09:45:34 -04:00
Ken Martin
d0be2896d7 changed cache manager and registered generators to no longer be singletons 2002-08-28 14:51:10 -04:00
Ken Martin
d99454cba4 now uses stubs 2002-08-26 10:52:04 -04:00
Ken Martin
13d4f89dfe compiler warnings 2002-08-23 15:13:49 -04:00
Ken Martin
2fc458ecce minor warning fix 2002-08-22 14:41:38 -04:00
Ken Martin
0401303263 fixed some warnings 2002-08-22 09:17:02 -04:00
Ken Martin
9f870d3efb minor bug 2002-08-21 13:16:07 -04:00