summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
Commit message (Collapse)AuthorAgeFilesLines
* fix more issues reported by clang-tidyDaniel Pfeifer2016-10-201-38/+54
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Ninja: Add internal tool to produce a ninja dyndep file for FortranBrad King2016-09-221-0/+7
| | | | | | | Create an internal `cmake -E cmake_ninja_dyndep` tool to read the "ddi" files generated by `cmake -E cmake_ninja_depends` from all sources in a target and generate a ninja dyndep file that tells Ninja about Fortran module dependencies within the target and on target dependencies.
* Ninja: Add internal tool to scan Fortran code for module dependenciesBrad King2016-09-221-0/+10
| | | | | | | | Create an internal `cmake -E cmake_ninja_depends` tool to scan an already-preprocessed Fortran translation unit for modules that it provides or requires. Save the information in a "ddi" file with a CMake-private format for intermediate dynamic dependency information. This file may the be loaded by another tool to be added later.
* server-mode: Introduce cmServerConnectionTobias Hunger2016-09-221-12/+30
| | | | | | | | Use it to split pipe and stdin/out handling out of cmServer itself. The server will shut down when it looses its connection to the client. This has the nice property that a crashing client will cause the server to terminate as the OS will close the connection on behave of the client.
* server-mode: Add --experimental flagTobias Hunger2016-09-201-4/+21
| | | | | | | | Allow for experimental cmProtocolVersions, which will only ever get listed if the server was started with the (undocumented) "--experimental" flag. Mark current protocol version 1.0 as experimental.
* cmake-server: Bare-bones server implementationTobias Hunger2016-09-191-0/+18
| | | | | | | | | | | | | | | Adds a bare-bones cmake-server implementation and makes it possible to start that with "cmake -E server". Communication happens via stdin/stdout for now. Protocol is based on Json objects surrounded by magic strings ("[== CMake Server ==[" and "]== CMake Server ==]"), which simplifies Json parsing significantly. This patch also defines an interface used to implement different versions of the protocol spoken by the server, but does not include any protocol implementaiton.
* cmake-server: Report server mode availablitily in CapabilitiesTobias Hunger2016-09-191-1/+5
| | | | | Report the availability of the server-mode in the output of cmake -E capabilities.
* cmcmd: Fix sort order in help outputTobias Hunger2016-09-131-1/+1
| | | | sort "sleep" before "tar", not after
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-9/+17
|
* CMake: don't use else after returnDaniel Pfeifer2016-08-181-9/+10
|
* cmake: Add `cmake -E capabilities` modeTobias Hunger2016-08-161-0/+12
| | | | | | | Add `cmake -E capabilities` to report on generators, cmake version and possibly other static capabilities of cmake. Closes: #15462
* Use better KWSys SystemTools::GetEnv and HasEnv signaturesDāvis Mosāns2016-07-181-10/+6
|
* cmake: Fix -E env_vs8_wince implementationBrad King2016-07-111-2/+2
| | | | | | | | | This code has accidentally not been compiled since commit v3.0.0-rc1~556^2 (cmake: Split -E command implementation into separate source file, 2013-10-03) because CMAKE_HAVE_VS_GENERATORS was local to `cmake.cxx`. Fixes #16195.
* cmake: Drop unused -E cmake_call_visual_studio_macro codeBrad King2016-07-111-24/+0
| | | | | | This code has not been compiled since commit v3.0.0-rc1~556^2 (cmake: Split -E command implementation into separate source file, 2013-10-03). It appears the code was never used since it was added anyway.
* Avoid using KWSys auto_ptr by adopting it ourselvesBrad King2016-06-291-3/+2
| | | | | | | | | | | | Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to our own implementation adopted from the KWSys auto_ptr implementation. Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers that do not warn about it. Automate the client site conversions: git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \ 's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
* use CM_NULLPTRDaniel Pfeifer2016-06-281-16/+23
|
* Add options to run `ldd -u -r` as a "link-what-you-use" toolBill Hoffman2016-06-171-4/+31
| | | | | | | Create a LINK_WHAT_YOU_USE target property and corresponding CMAKE_LINK_WHAT_YOU_USE variable to enable this behavior. Extend link commands by running `ldd -u -r` to detect shared libraries that are linked but not needed.
* Simplify boolean expressionsDaniel Pfeifer2016-06-021-6/+2
| | | | | | Use clang-tidy's readability-simplify-boolean-expr checker. After applying the fix-its, revise all changes *very* carefully. Be aware of false positives and invalid changes.
* Remove redundant c_str() calls.Daniel Pfeifer2016-05-261-2/+1
| | | | | Run clang-tidy's readability-redundant-string-cstr checker. Ignore findings in kwsys.
* Improve string find: prefer character overloads.Daniel Pfeifer2016-05-241-1/+1
| | | | | Apply fix-its from clang-tidy's performance-faster-string-find checker. Ignore findings in kwsys.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-822/+507
| | | | | | | | | | | | | 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* Help: Improve 'cmake -E md5sum' documentationBartosz Kosiorek2016-05-021-1/+1
|
* Merge topic 'clang-format-include-order'Brad King2016-05-021-4/+5
|\ | | | | | | | | | | | | | | | | | | | | e1c77472 Format include directive blocks and ordering with clang-format 180538c7 Source: Stabilize include order 0e7bca92 Utilities/Release: Stabilize include order in WiX custom action eb817be0 Tests: Stabilize include order in MFC, VSXaml, and VSWinStorePhone eda313b4 Tests: Stabilize include order in StringFileTest 7110b754 CursesDialog: add missing cmState include d7a5f255 Modules: Remove unused CMakeTestWatcomVersion.c file
| * Format include directive blocks and ordering with clang-formatBrad King2016-04-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
| * Source: Stabilize include orderBrad King2016-04-291-0/+1
| | | | | | | | | | 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.
* | Clang-Tidy: Give entire compiler command line to clant-tidy toolDaniel Pfeifer2016-04-281-2/+4
|/ | | | | The tool expects the entire compiler command, including `cc`. It will automatically skip that and extract the options it needs.
* Clang-Tidy: copy stdout to sterr; ignore original stderrDaniel Pfeifer2016-04-271-3/+7
| | | | | | | | | | | Clang-Tidy writes the number of warnings, the number of suppressed warnings, and instructions on how to suppress warnings to stderr. Since each source file is checked individually, this repetitive information is disturbing and should be suppressed. The actual warning messages are written to stdout. Some IDEs (eg. QtCreator) analyze only stderr for issues. Redirecting Clang-Tidy's stdout to stderr makes sure the warnings are correctly displayed.
* Add options to run clang-tidy with the compilerDaniel Pfeifer2016-04-131-21/+59
| | | | | | Create a <LANG>_CLANG_TIDY target property (initialized by a CMAKE_<LANG>_CLANG_TIDY variable) to specify a clang-tidy command line to be run along with the compiler.
* Fix dependency scanning configuration in subdirectoriesBrad King2016-02-051-4/+2
| | | | | | | | | | | | | | | Refactoring in commit v3.5.0-rc1~347^2~2 (Set the current dirs on the snapshot before creating the cmMakefile) accidentally changed the source and binary directories configured in `cmake -E cmake_depends` for use during dependency scanning. This can cause the wrong directory information to be loaded. It also breaks Fortran module dependency scanning for modules provided by targets in subdirectories that do not have Fortran_MODULE_DIRECTORY set. Fix the dependency scanning directory configuration and add a test to cover the Fortran module case in which the breakage was observed. Reported-by: Kelly Thompson <kgt@lanl.gov>
* cmake: Fix `-E time` argument passing to childBrad King2016-01-201-2/+2
| | | | | | | | | | Since this command was introduced in 2002 it has incorrectly constructed the child process command line by concatenating arguments separated by spaces with no quoting. Fix this by passing the command argument vector directly to RunSingleCommand without an intermediate quoting and re-parsing step. Reported-by: Andrey Pokrovskiy <wonder.mice@gmail.com>
* cmcmd.cxx: Remove unused code in __run_iwyu implementationBrad King2016-01-191-3/+2
| | | | | Do not try to capture stderr with OUTPUT_PASSTHROUGH. RunSingleCommand will never populate it.
* cmake: Change `-E chdir` to pass through stdout/stderr directlyBrad King2016-01-191-1/+1
| | | | | Use OUTPUT_PASSTHROUGH instead of OUTPUT_NORMAL in order to avoid buffering the output just to re-print it.
* cmake: Teach -E make_directory to support multiple input directoriesBartosz Kosiorek2015-12-101-7/+12
|
* cmake: Teach -E copy_directory to support multiple input directoriesBartosz Kosiorek2015-12-071-9/+15
|
* cmake: Refine -E copy_if_different implementation indentationBartosz Kosiorek2015-12-071-2/+2
|
* cmake: Refine -E chdir documentationBartosz Kosiorek2015-12-071-1/+1
|
* cmake: Teach -E copy[_if_different] to support multiple files (#15703)Bartosz Kosiorek2015-12-041-15/+46
| | | | | | If multiple input files are provided then the destination must be a directory. If only one input file is provided then destination may be either a file or directory.
* cmake: Improve '-E' help message formattingBartosz Kosiorek2015-12-041-6/+6
|
* Merge topic 'fix-ms-manifest-no-linker'Brad King2015-11-191-1/+3
|\ | | | | | | | | ca263d1d MSVC: Fix linking with /MANIFEST:NO option
| * MSVC: Fix linking with /MANIFEST:NO optionBrad King2015-11-181-1/+3
| | | | | | | | | | | | Refactoring in commit v3.4.0-rc1~74^2~1 (MSVC: Rewrite manifest file handling with Makefile and Ninja, 2015-09-15) broke handling of this option. Fix it and add a test case.
* | De-duplicate symbols listed in generated module definition filesBill Hoffman2015-11-181-3/+5
| | | | | | | | | | | | | | MS tools have a limit on the number of symbols that can be listed in a `.def` file. If multiple `.obj` files provide a symbol then avoid listing it more than once in the generated `.def` file to avoid counting toward the limit.
* | cmState: Initialize default definitions immediately.Stephen Kelly2015-10-131-0/+1
| | | | | | | | Don't leave this as cmMakefile responsibility.
* | Set the current dirs on the snapshot before creating the cmMakefile.Stephen Kelly2015-10-071-2/+4
|/ | | | | | The cmMakefile should get a fully prepared snapshot and not clobber its definitions. It should eventually be able to process list files from any starting-point snapshot, though that is some refactoring away still.
* Add support for *.manifest source files with MSVC toolsBrad King2015-09-171-5/+16
| | | | | | | | Classify .manifest sources separately, add dependencies on them, and pass them to the MS manifest tool to merge with linker-generated manifest files. Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
* MSVC: Rewrite manifest file handling with Makefile and NinjaBrad King2015-09-171-184/+221
| | | | | | | | | Add a helper class private to "cmcmd.cxx" to contain the implementation. Update the link logic to use the intermediate files directory for each target to hold manifest and resource files before embedding into the binary. Preserve the old behavior of placing the .manifest file next to the binary when not linking incrementally even though it will be embedded.
* cmLocalGenerator: Create from already-constructed cmMakefile.Stephen Kelly2015-08-281-1/+2
| | | | Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
* cmGlobalGenerator: Remove MakeLocalGenerator method.Stephen Kelly2015-08-281-1/+1
| | | | Inline implementation to callers.