Commit Graph

40 Commits

Author SHA1 Message Date
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 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
Stephen Kelly 94fd5a5af8 VS: Port ImplibDir to cmGeneratorTarget 2015-10-24 09:19:56 +02:00
Stephen Kelly 26e23e8463 VS: Port ComputeLongestObjectDirectory to cmGeneratorTarget 2015-10-24 09:19:56 +02:00
Stephen Kelly ff8ac8ee6a cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
2015-08-28 18:44:39 +02:00
Stephen Kelly 9b6a743b80 cmLocalGenerator: Remove Parent pointer. 2015-08-28 18:44:38 +02:00
Stephen Kelly 3b880a0741 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a
cmState::Snapshot.  Adjust MakeLocalGenerator to use the 'current'
snapshot in cases where there is no parent.  Create the snapshot
for subdirectories in cmMakefile::AddSubdirectory.

This means that snapshots are now created at the point of extending the tree,
as appropriate, and independently of the cmLocalGenerator and cmMakefile they
represent the state for.
2015-05-27 09:18:32 -04:00
Stephen Kelly e435f875ec VS: Move version information to global generator. 2015-05-19 11:02:33 -04:00
Stephen Kelly 34c9ee2ed7 cmLocalGenerator: Require a global generator in the constructor.
Port generator factory methods to pass it.
2015-05-14 20:36:27 +02:00
Stephen Kelly a48aebcb67 cmLocalGenerator: Require a parent in the constructor.
Pass the parent though cmGlobalGenerator::CreateLocalGenerator.

This will make it easy to initialize state scopes independent of
cmMakefile.
2015-04-28 07:50:52 +02:00
Brad King 65624c39e3 VS14: Add Visual Studio 14 generator (#14982)
Call the generator "Visual Studio 14" without any year because this
version of VS does not provide a year in the product name.

Copy cmGlobalVisualStudio12Generator to cmGlobalVisualStudio14Generator
and update version numbers accordingly.  Add the VS14 enumeration value.
Teach the platform module Windows-MSVC to set MSVC14 and document the
variable.  Teach module InstallRequiredSystemLibraries to look for the VS
14 runtime libraries.

Teach tests CheckCompilerRelatedVariables, VSExternalInclude, and
RunCMake.GeneratorToolset to treat VS 14 as they do VS 10, 11, and 12.

Co-Author: Pawel Stopinski <diokhan@go2.pl>
2014-06-25 14:51:19 -04:00
Stephen Kelly f6da044080 cmLocalGenerator: Add ComputeObjectFilenames interface.
Implement it in the local generators and use it in the global
generators.
2014-03-13 15:28:02 +01:00
Brad King bc993f277e Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the
command lines of a custom command.  Generalize it to get the comment,
working directory, dependencies, and outputs of custom commands.  Update
use in all generators to support this.
2014-03-12 10:44:01 -04:00
Ben Boeckel b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel 84fdc9921c stringapi: Pass configuration names as strings 2014-03-08 13:05:36 -05:00
Brad King 77ac9b8b9c VS12: Add Visual Studio 12 generator (#14251)
Copy cmGlobalVisualStudio11Generator to cmGlobalVisualStudio12Generator
and update version numbers accordingly.  Add the VS12 enumeration value.
Add module CMakeVS12FindMake to find MSBuild.  Look for MSBuild in its
now-dedicated Windows Registry entry.  Teach the platform module
Windows-MSVC to set MSVC12 and document the variable.  Teach module
InstallRequiredSystemLibraries to look for the VS 12 runtime libraries.

Teach tests CheckCompilerRelatedVariables, Preprocess, VSExternalInclude,
and RunCMake.GeneratorToolset to treat VS 12 as they do VS 10 and 11.

Inspired-by: Minmin Gong <minmin.gong@gmail.com>
2013-06-28 18:13:14 -04:00
Brad King 01e979acef VS: Add CMakeLists.txt re-run rules at start of generation
Since commit 328c0f65 (Simplify cmVisualStudio10TargetGenerator source
classification, 2012-03-19) the VS 10 generator uses the
cmGeneratorTarget source classification instead of directly getting the
list of source files from the target.  This accidentally dropped the
CMakeLists.txt files from generated projects because they are added too
late for cmGeneratorTarget.

All generator-specific source files must be added to targets prior to
cmGeneratorTarget construction.  Refactor addition of the CMakeLists.txt
files with CMake re-run custom commands to take place before normal
generation begins, and therefore early enough to be included in the
cmGeneratorTarget classification.
2012-03-28 14:07:51 -04:00
Brad King d57047de33 Pre-compute object file names before VS project generation
Implement cmGlobalGenerator::ComputeTargetObjects in the VS generator
to pre-compute all the object file names.  Use the results during
generation instead of re-computing it later.
2012-03-09 15:16:02 -05:00
Brad King 67734be8cf VS: Simplify object name computation
Simplify cmLocalVisualStudioGenerator::ComputeObjectNameRequirements to
loop over the original vector of source files instead of recursively
traversing source groups just to find the same files.  Drop from
cmVisualStudio10TargetGenerator::ComputeObjectNames temporary source
group calculation now that it is not needed for computing object names.
2012-03-06 13:30:19 -05:00
Brad King c92ffece80 Enumerate VS11 version explicitly in local generators
Since the parent commit the local generator Version ivar may be
compared for ordering.  Convert comparisons:

  "==VS10" becomes ">=VS10"
  "!=VS10" becomes "< VS10"

to support an explicit enumeration value for VS11 with no change
in behavior.
2011-11-14 09:50:47 -05:00
Brad King 1be4b6f463 Order VS local generator Version ivar values consistently
Move the Version member to the top cmLocalVisualStudioGenerator class
and set it consistently for instances created by all the global
generator versions.  Use an enumeration type with values scaled by a
factor of 10 so we can handle VS 7.1 without out-of-order numbers.

VS 7.1 support for SuppressStartupBanner was broken by commit 25116a3c
(Fix CMAKE_VERBOSE_MAKEFILE for VS10 vcxproj files, 2011-10-11) because
it assumed comparison of VS version numbers works.  Now it does.
2011-11-14 09:47:31 -05:00
Brad King b98fdd5284 VS: Use setlocal/endlocal only in VS 10 custom commands
The setlocal/endlocal and errorlevel pattern added by commit 06fcbc47
(VS10: Fix working directory of consecutive custom commands, 2011-04-08)
does not work well in VS 7.1.  Restore the original behavior for VS
versions that do not need the new behavior.
2011-04-11 11:53:31 -04:00
Brad King 06fcbc4757 VS10: Fix working directory of consecutive custom commands (#11938)
The VS 10 msbuild tool uses a single command shell to invoke all the
custom command scripts in a project.  Isolate the environment and
working directory of custom commands using setlocal/endlocal.  The
form of each command is

  set errlev=
  setlocal
  cd c:\work\dir
  if %errorlevel% neq 0 goto :cmEnd
  c:
  if %errorlevel% neq 0 goto :cmEnd
  command1 ...
  if %errorlevel% neq 0 goto :cmEnd
  ...
  commandN ...
  if %errorlevel% neq 0 goto :cmEnd
  :cmEnd
  endlocal & set errlev=%errorlevel%
  if %errlev% neq 0 goto :VCEnd

so that all changes to the environment and working directory are
isolated within the script and the return code is preserved.
2011-04-08 15:36:16 -04:00
Brad King 2516c05c2c VS: Create a Fortran DLL's import library directory
The Intel Fortran plugin forgets to create the output directory into
which it will write a DLL's import library.  Utilize the fix added by
commit f4b3bdc6 (Create an exe's implib output dir for VS, 2009-06-15)
and generalized by commit 764ac980 (Generalize exe implib dir creation
for VS, 2009-06-16).  Create a pre-link rule to make the directory.
2011-02-10 16:17:44 -05:00
Brad King 533f5a2037 Merge topic 'custom-command-refactor'
53ea8b3 Merge branch 'imported-target-dependencies' into custom-command-refactor
1a29cca Remove cmLocalGenerator::GetRealLocation
542b517 Factor out common custom command generator
6fe5b3d Simplify VS generator ConstructScript interface
2010-12-21 14:03:02 -05:00
David Cole 66e7917532 VS10: stop build on custom command error (#11533)
In VS9 and previous versions, :VCReportError is the goto label
to jump to after a failed custom command. It stops the build
before it tries to go any further.

In VS10, :VCEnd is the correct label to use.

Create a method in the VS generators to provide the correct
line of script to use for each version of Visual Studio.

For more internal details, search for VCEnd in the
C:\Program Files\MSBuild directory.
2010-12-17 11:11:55 -05:00
Brad King 6fe5b3db0b Simplify VS generator ConstructScript interface
Pass to cmLocalVisualStudioGenerator::ConstructScript a cmCustomCommand
instance instead of extracting arguments at all call sites.
2010-12-08 17:29:20 -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 355511ade9 Do Windows command line escapes for VS 10 too
Until now the VS 10 generator did no Windows command-line escaping and
just did XML escapes.  This commit teaches the generator to use the same
command-line escape addition code used by other generators.  The script
construction method cmLocalVisualStudioGenerator::ConstructScript need
not do XML escapes.  Each VS generator version adds the XML escapes
necessary for that version.
2009-09-07 10:11:20 -04:00
Bill Hoffman 5c4208f50e ENH: only 5 failing tests for VS 10 2009-07-10 09:12:39 -04:00
Bill Hoffman 7491f52992 ENH: first pass at VS 10, can bootstrap CMake, but many tests still fail 2009-06-25 16:41:57 -04:00
Brad King 764ac9803d ENH: Generalize exe implib dir creation for VS
In VS 7,8,9 executable targets we generate a build event to create the
output directory for the import library in case the executable marks
symbols with dllexport (VS forgets to create this directory).  This
generalizes computation of the custom command line to support future use
with other VS versions.
2009-06-16 11:44:07 -04:00
Alexander Neundorf 94f0eca689 BUG: fix #5326: source files with the same name in different groups lead to colliding object file names
Alex
2007-08-27 17:05:43 -04:00
Brad King 15f21aa74c STYLE: Removed stray comment. 2007-07-09 14:30:33 -04:00
Alexander Neundorf 7f11536704 ENH: now target names can be used in add_custom_command() and
add_custom_target() as COMMAND, and cmake will recognize them and replace
them with the actual output path of these executables. Also the dependency
will be added automatically. Test included.
ENH: moved TraceVSDependencies() to the end of GlobalGenerator::Configure(),
so it is done now in one central place

Alex
2007-05-09 08:25:45 -04:00
Bill Hoffman ca0230a33e ENH: check in initial conv library stuff 2007-02-16 16:12:17 -05:00
Brad King dd332a00cc ENH: Re-implemented command line argument shell quoting to support several platforms with one code base. 2006-09-27 13:43:46 -04:00
Brad King 2459ceb076 BUG: Centralized generation of command line arguments in escaped form. This addresses bug#3786 for several platforms. 2006-09-21 15:14:06 -04:00
Brad King 8dda3a2f6e ENH: Adding .hh file as a C++ header file extension. Remove duplicate code from implementation of unique object name computation for VS generators. This addresses bug#3565. 2006-08-01 10:48:40 -04:00
Brad King 9bf5af6e32 ENH: Moved unique object file name computation from cmLocalUnixMakefileGenerator3 up to cmLocalGenerator for use by all generators. Created cmLocalVisualStudioGenerator as superclass for all VS generators. Implemented on-demand unique object file name computation for VS 7 generator to avoid slow compiles when all sources are in subdirectories. 2006-07-11 11:41:38 -04:00