summaryrefslogtreecommitdiffstats
path: root/Tests/CustomCommand
Commit message (Collapse)AuthorAgeFilesLines
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-3/+4
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * 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.
* add_custom_{command,target}: Add COMMAND_EXPAND_LISTS optionEd Branch2017-01-142-0/+35
| | | | | | This option allows lists generated by generator expressions to be expanded. Closes: #15935
* Use string(APPEND) in TestsDaniel Pfeifer2016-07-271-3/+3
| | | | | | | Automate with: find Tests -type f -print0 | xargs -0 perl -i -0pe \ 's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
* Revise C++ coding style using clang-formatKitware Robot2016-05-164-29/+28
| | | | | | | | | | | | | 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.
* Drop Visual Studio 6 generatorBrad King2016-03-091-8/+2
| | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* Merge topic 'fix-OBJECT_DEPENDS-after-path-normalization'Brad King2015-01-293-0/+19
|\ | | | | | | | | 9259d778 Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
| * Normalize OBJECT_DEPENDS paths to match custom commands (#15366)Brad King2015-01-283-0/+19
| | | | | | | | | | | | | | | | | | | | Custom command path normalization added in commit v3.1.0-rc1~471^2 (add_custom_command: Normalize OUTPUT and DEPENDS paths, 2014-05-28) broke use of OBJECT_DEPENDS to bring in custom commands because the latter paths were not normalized too. Normalize them and add a test case. Reported-by: Daniel v. Gerpen
* | Encoding: Modify tests to work using non-ascii paths.Clinton Stimpson2015-01-093-10/+1
| | | | | | | | | | | | | | | | | | | | For complex*, CustomCommand and OutDir tests, non-ascii paths are avoided in test code by using relative paths, and setting the working when running the test. This also avoids the need to internationalize the test code. For RunCMake.GeneratorExpression, use a UTF-8 encoding in file(STRINGS) to retrieve the compiled absolute path correctly.
* | Add an option for explicit BYPRODUCTS of custom commands (#14963)Brad King2014-11-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Add USES_TERMINAL option for custom commandsPeter Collingbourne2014-11-141-0/+23
|/ | | | | | Teach the add_custom_command and add_custom_target commands a new USES_TERMINAL option. Use it to tell the generator to give the command direct access to the terminal if possible.
* add_custom_command: Normalize OUTPUT and DEPENDS paths.Stephen Kelly2014-05-281-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | While tracing dependencies of a target, cmTargetTraceDependencies follows sources by full path to determine if the source is to be produced by a custom command. Commit 4959f341 (cmSourceFileLocation: Collapse full path for directory comparisons., 2014-03-27) changed the storage of target sources to be in the form of a normalized path instead of an unnormalized path. The path is followed by looking it up in a mapping via cmMakefile::GetSourceFileWithOutput to acquire an appropriate cmSourceFile. The mapping is populated with the OUTPUT components of add_custom_command invocations, however it is populated with unnormalized paths. This means that the tracing logic does not find appropriate cmSourceFiles, and does not generate appropriate build rules for the generated sources. Normalize the paths in the OUTPUT components of add_custom_command to resolve this. The paths in the DEPENDS component of add_custom_command are also not normalized, leading to the same problem again. Normalize the depends paths after generator evaluation and expansion.
* Replace string(REGEX REPLACE) with string(REPLACE) where possibleRolf Eike Beer2014-04-141-2/+2
| | | | The simple replacement is much faster.
* add_custom_command: Evaluate generator expressions in DEPENDSStephen Kelly2014-03-201-2/+5
| | | | | | | Rely on evaluation in cmCustomCommandGenerator for the generators. When tracing target dependencies, depend on the union of dependencies for all configurations.
* Tests: Don't read the LOCATION property from build targets.Stephen Kelly2013-11-191-4/+1
|
* Drop use of configure_file IMMEDIATE optionDaniele E. Domenichelli2013-11-131-2/+2
| | | | | | Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08) we no longer need to use the configure_file IMMEDIATE option to support compatibility modes less than 2.0.
* Generators: don't append sources from utility targets to objectSourcesNils Gladitz2013-10-282-0/+7
|
* Add a test to expose a bug with add_custom_command and ninja.Robert Maynard2013-06-251-0/+13
| | | | | Ninja Generator is unable to handle an add_custom_command having a dependency that is generated at build time by a previous target.
* Remove CMake-language block-end command argumentsKitware Robot2012-08-132-4/+4
| | | | | | | | | | | | | | | | | Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Convert CMake-language commands to lower caseKitware Robot2012-08-134-84/+84
| | | | | | | | | | | | | | | | | Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Remove trailing whitespace from most CMake and C/C++ codeKitware Robot2012-08-133-17/+17
| | | | | | | | | | | | | | | | | 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/ \+$//'
* Tests/CustomCommand: Do not use 'main' in a libraryBrad King2012-07-091-1/+1
| | | | | | | | Otherwise when linking 'CustomCommand' some linkers report ld: 0711-224 WARNING: Duplicate symbol: .main Suggested-by: Daniel R. Gomez <gomez@teragram.com>
* Normalize slashes of add_custom_(command|target) DEPENDS (#11973)Brad King2011-03-301-1/+1
| | | | | | | | | | | | | | | | All commands accepting file paths should normalize the slashes so that the string-represented names can be compared reliably. The commands add_library and add_executable have done this for years. We taught add_custom_command to normalize its OUTPUT names in commit a75a0a14 (Normalize add_custom_command OUTPUT names, 2010-12-15). We handled a special case of the DEPENDS option in commit 7befc007 (Handle trailing slashes on add_custom_command DEPENDS, 2011-01-26). Teach both add_custom_command and add_custom_target to normalize slashes of DEPENDS files up front. This approach subsumes the above-mentioned special case so remove the one line added for it but keep its test. Extend the CustomCommand test to check that slash count mismatches between custom command OUTPUT and DEPENDS can still be linked correctly.
* Merge topic 'custom-command-generator-expressions'Brad King2010-12-211-0/+13
|\ | | | | | | | | | | | | | | | | | | | | 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
| * Mark CustomCommand test perconfig.out as SYMBOLICBrad King2010-12-201-0/+1
| | | | | | | | | | The custom command with this output does not actually create the file, so mark it as SYMBOLIC.
| * Introduce "generator expression" syntax to custom commands (#11209)Brad King2010-12-151-0/+12
| | | | | | | | | | | | | | | | | | Evaluate in the COMMAND arguments of custom commands the generator expression syntax introduced in commit d2e1f2b4 (Introduce "generator expressions" to add_test, 2009-08-11). These expressions have a syntax like $<TARGET_FILE:mytarget> and are evaluated during build system generation. This syntax allows per-configuration target output files to be referenced in custom command lines.
* | Normalize add_custom_command OUTPUT names (#10485)Brad King2010-12-151-1/+1
|/ | | | | | | | | | | | Previously the OUTPUT arguments of add_custom_command were not slash-normalized but those of add_library and add_executable were. This caused the example add_custom_command(OUTPUT a//b.c ...) add_library(... a//b.c ...) to fail at build time with "no rule to make a/b.c". Fix this and modify the CustomCommand test to try it.
* Skip file-level dependencies on custom targets (#11332)Brad King2010-12-081-4/+1
| | | | | | | A custom command may name a target created by add_custom_target in its DEPENDS field. Treat this case as a target-level dependency only since a custom target provides no standard file on which to add a file-level dependency.
* Avoid CustomCommand test failure on VS71 (#9963)David Cole2010-09-201-1/+5
| | | | | | | Test still failing on dash1.kitware. Give up on testing the new arg on MSVC71. Test it with newer nmakes instead. All other dashboards are fine with -DPATH=c:/posix/path as the first arg, so keep it except when MSVC71 is true.
* Avoid CustomCommand test failure on VS71 (#9963)David Cole2010-09-141-2/+0
| | | | | | | | | | The new first arg in the test is the critical one to prove that the new NMake specific code works. The additional colons in the middle of the arg stream work fine everywhere else, but not on dash1.kitware with Visual Studio 7.1. Just avoid the failure for now by removing the unnecessary new args from the test.
* No extra spaces in CustomCommand test (#9963)David Cole2010-09-121-5/+10
| | | | | | | | | | | | | | | | | | The nightly dashboard showed that the following platforms had difficulties dealing with "bin dir" and/or "check command line" as directory and file names: AIX Borland 5.5, 5.6 and 5.8 IRIX NMake 6.0 OpenBSD VS 7.1 Watcom Re-visit later, after the release, to use spaces in the bin dir and in the target name where possible.
* Enable calling commands with : in argv[1] (#9963)David Cole2010-09-101-6/+11
| | | | | | | | | | | | | | | | | | | The solution seems hackish, but it works: for NMake only, prepend a no-op command before each real command that begins with ". This is really a work-around for an NMake problem. When a command begins with ", nmake truncates the first argument to the command after the first : in that arg. It has a parsing problem. Workaround..., hackish..., but it should solve the issue for #9963 and its related friends. Also, modify the CustomCommand test to replicate the problem reported in issue #9963. Before the NMake specific code change, the test failed. Now, it passes. Ahhhhhh.
* Oops. Last commit did not create subdir before doing a touch on a file in ↵David Cole2009-09-251-0/+1
| | | | it. So it fails on some platforms. This fixes that.
* Fix CMake Internal Error from cmTarget::GetOutputInfo - triggered by calling ↵David Cole2009-09-251-0/+27
| | | | GetLocation on a utility target - caused by custom command output file with same name as custom target. The fix is to avoid calling GetLocation unless the target is of a type that is expected to have a location...
* ENH: Remove CMAKE_ANSI_CFLAGS from testsBrad King2009-07-081-1/+0
| | | | | As of CMake 2.6 this variable is not defined, and the ANSI flags for the HP compiler are simply hard-coded in the default C flags.
* BUG: Fix windows command line escape for empty argBrad King2008-12-181-3/+3
| | | | | | On Windows the KWSys System package generates escapes for command-line arguments. This fix enables quoting of the empty string as an argument. This also adds a test to pass an empty argument to a custom command.
* ENH: Allow custom sources in custom targetsBrad King2008-10-091-0/+1
| | | | | | | This adds a SOURCES option to ADD_CUSTOM_TARGET, enabling users to specify extra sources for inclusion in the target. Such sources may not build, but will show up in the IDE project files for convenient editing. See issue #5848.
* ENH: Test relative path custom command outputBrad King2008-08-051-1/+11
| | | | | | | As of CMake 2.6 a custom command output specified by relative path is placed in the build tree. This adds a test to make sure other references to the output are hooked up correctly, fixing a bug in CMake 2.6.1.
* BUG: Fix new custom command with make-var expansion test on VS6. The VS6 ↵Brad King2008-06-051-2/+8
| | | | IDE adds some extra characters to the variable value during expansion.
* ENH: Add test for make variable replacement in a custom command with the ↵Brad King2008-06-042-0/+14
| | | | VERBATIM option.
* ENH: Remove SKIP_RULE_DEPENDS option from add_custom_command()Brad King2008-06-023-11/+1
| | | | | | | | - Option was recently added but never released. - Custom commands no longer depend on build.make so we do not need the option. - Rule hashes now take care of rebuilding when rules change so the dependency is not needed.
* ENH: Add SKIP_RULE_DEPENDS option for add_custom_command()Brad King2008-05-143-1/+11
| | | | | | - Allows make rules to be created with no dependencies. - Such rules will not re-run even if the commands themselves change. - Useful to create rules that run only if the output is missing.
* BUG: Fix escaping of more characters on Windows shells.Brad King2008-04-301-13/+21
|
* BUG: Do not escape shell operators when generating command lines.Brad King2008-04-295-3/+37
| | | | | - See bug#6868. - Update CustomCommand test to check.
* ENH: preclean some warningsKen Martin2008-03-251-0/+1
|
* ENH: Implemented generation of display for pre-build, pre-link, and ↵Brad King2007-12-181-0/+2
| | | | post-build custom command comments during the build. This addresses issue #5353.
* ENH: Re-arranged code to test adding a custom command to generate a source ↵Brad King2007-06-111-12/+9
| | | | file after the file has been added to a target. This is supported by the current implementation because of the use of source lists in the target implementation. When we later convert to creating cmSourceFile instances immediately for the target we need to make sure the mentioned case still works.
* BUG: Replace "with space" in custom command argument tests with "w s" to ↵Brad King2007-05-181-46/+46
| | | | still have whitespace but be shorter. The test was failing because the custom command line length was simply too long for the VS IDE.
* ENH: Added quick means to turn on verbose output for debugging this test.Brad King2007-05-182-1/+5
|
* ENH: Add testing of * and / character arguments except on MinGW.Brad King2007-05-171-2/+5
|
* ENH: Added test for custom command lines with special single-character ↵Brad King2007-05-171-4/+8
| | | | arguments.