summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudioGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Add an option for explicit BYPRODUCTS of custom commands (#14963)Brad King2014-11-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* cmLocalGenerator: Add ComputeObjectFilenames interface.Stephen Kelly2014-03-131-0/+40
| | | | | Implement it in the local generators and use it in the global generators.
* Generalize cmCustomCommandGenerator to more fieldsBrad King2014-03-121-4/+2
| | | | | | | 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.
* cmCustomCommand: Return std::string from GetWorkingDirectoryBrad King2014-03-121-4/+4
|
* stringapi: Miscellaneous char* parametersBen Boeckel2014-03-081-2/+2
|
* stringapi: Pass configuration names as stringsBen Boeckel2014-03-081-2/+2
|
* Resolve warnings about unused variables.Stephen Kelly2012-11-071-1/+0
|
* Pre-compute object file names before VS project generationBrad King2012-03-091-63/+0
| | | | | | 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.
* VS: Simplify object name computationBrad King2012-03-061-57/+30
| | | | | | | | 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.
* VS: Use "call " keyword with .cmd and .bat file custom commands (#12445)David Cole2011-11-181-0/+14
| | | | | | | Similar fix to commit d093abef for the Makefile generators. Prevents premature exit from sequence of commands. Even when no errors occur, the previous construct without "call " was exiting the sequence before executing the full set of commands...
* Order VS local generator Version ivar values consistentlyBrad King2011-11-141-1/+2
| | | | | | | | | | | 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.
* VS10: Fix exit code of custom commands with setlocal/endlocal (#11938)Brad King2011-04-111-4/+8
| | | | | | | | | | | | | | | Use the pattern setlocal ... endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd in custom commands to preserve the %errorlevel% from inside the setlocal/endlocal block.
* VS: Use setlocal/endlocal only in VS 10 custom commandsBrad King2011-04-111-13/+37
| | | | | | | 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.
* VS10: Fix working directory of consecutive custom commands (#11938)Brad King2011-04-081-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* VS: Create a Fortran DLL's import library directoryBrad King2011-02-101-2/+6
| | | | | | | | 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.
* Merge topic 'custom-command-generator-expressions'Brad King2010-12-211-1/+1
|\ | | | | | | | | | | | | | | | | | | | | 4499d50 Mark CustomCommand test perconfig.out as SYMBOLIC f0cdb60 Introduce "generator expression" syntax to custom commands (#11209) 4749e4c Record set of targets used in cmGeneratorExpression ef9e9de Optionally suppress errors in cmGeneratorExpression 45e1953 Factor per-config sample targets out of 'Testing' test 4091bca Factor generator expression docs out of add_test bfb7288 Record backtrace in cmCustomCommand
| * Record backtrace in cmCustomCommandBrad King2010-12-151-1/+1
| | | | | | | | | | This will be used to report custom command errors to the user with a backtrace pointing at the add_custom_command or add_custom_target call.
* | Merge topic 'custom-command-refactor'Brad King2010-12-211-33/+12
|\ \ | |/ | | | | | | | | | | | | 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
| * Factor out common custom command generatorBrad King2010-12-081-31/+8
| | | | | | | | | | | | The Makefile, VS, and Xcode generators previously duplicated some custom command line generation code. Factor this out into a separate class cmCustomCommandGenerator shared by all generators.
| * Simplify VS generator ConstructScript interfaceBrad King2010-12-081-4/+6
| | | | | | | | | | Pass to cmLocalVisualStudioGenerator::ConstructScript a cmCustomCommand instance instead of extracting arguments at all call sites.
* | VS10: stop build on custom command error (#11533)David Cole2010-12-171-1/+13
|/ | | | | | | | | | | | | | 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.
* Partial fix from bug #10503, use full paths to fix custom commands.Bill Hoffman2010-04-021-1/+1
| | | | This fixes tests ExternalProject and LinkDirectory for VS 2010.
* Add errorlevel checking after each custom command in a sequence.David Cole2010-03-111-1/+9
| | | | | | | This makes the behavior of the build with the Visual Studio generators equivalent to the behavior of makefile based builds. After an error in a custom command sequence, the build stops and reports an error rather than executing the remaining commands in the sequence.
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | 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.
* Do Windows command line escapes for VS 10 tooBrad King2009-09-071-20/+1
| | | | | | | | | 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.
* ENH: only 5 failing tests for VS 10Bill Hoffman2009-07-101-1/+20
|
* ENH: Generalize exe implib dir creation for VSBrad King2009-06-161-0/+30
| | | | | | | | 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.
* ENH: remove patch as directory change was already fixedBill Hoffman2008-01-151-7/+0
|
* BUG: fix for bug 6234, use cd /d so that drives can be changed.Bill Hoffman2008-01-151-0/+8
|
* BUG: When the working directory for a custom command is on another drive ↵Brad King2007-12-171-0/+10
| | | | letter we need to change to that drive letter after changing its working directory. Fixes issue #6150.
* BUG: fix #5326: source files with the same name in different groups lead to ↵Alexander Neundorf2007-08-271-22/+38
| | | | | | colliding object file names Alex
* ENH: Merging changes from branch CMake-SourceFile2-b between tagsBrad King2007-06-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* ENH: now target names can be used in add_custom_command() andAlexander Neundorf2007-05-091-2/+5
| | | | | | | | | | 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
* ENH: check in initial conv library stuffBill Hoffman2007-02-161-1/+2
|
* ENH: do not use relative paths for custom command commands if they working ↵Bill Hoffman2007-01-181-1/+8
| | | | directory is used
* BUG: Avoid leading and trailing newlines in custom command scripts because ↵Brad King2006-10-251-6/+12
| | | | some VS6 versions do not like the trailing backslash this produces. This addresses bug#3977.
* ENH: Re-implemented command line argument shell quoting to support several ↵Brad King2006-09-271-1/+12
| | | | platforms with one code base.
* BUG: Centralized generation of command line arguments in escaped form. This ↵Brad King2006-09-211-0/+51
| | | | addresses bug#3786 for several platforms.
* BUG: Duplicate object name detection should not be case sensitive since this ↵Brad King2006-08-081-5/+8
| | | | code is used on Windows file systems. This addresses bug#3589.
* BUG: Make sure sources with unknown extensions are not compiled by VS.Brad King2006-08-031-3/+13
|
* ENH: Adding .hh file as a C++ header file extension. Remove duplicate code ↵Brad King2006-08-011-8/+12
| | | | from implementation of unique object name computation for VS generators. This addresses bug#3565.
* STYLE: fix long linesKen Martin2006-07-181-3/+2
|
* ENH: Moved unique object file name computation from ↵Brad King2006-07-111-0/+89
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.