summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Tolerate removed/replaced CMakeCache.txt with old CMakeFiles/Brad King2016-11-171-0/+20
| | | | | | | | | | | Users or scripts commonly remove or replace `CMakeCache.txt` without also removing `CMakeFiles/`. In this case the information saved in the cache from platform information initialization is missing, so we need to re-initialize it. In such a case, remove the platform information directory so that re-initialization will occur and restore needed information to the cache. Closes: #14820
* Merge topic 'import-librhash'Brad King2016-11-101-9/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cd8a57ae Add option to build CMake against a system librhash 71180fc8 FindLibRHash: Add module to find the librhash package 3216e94c Remove unused cm_sha2 infrastructure 5420278d Port hash computation to cmCryptoHash 9a596b33 cmCryptoHash: Re-implement in terms of librhash 47f91a61 cmCryptoHash: Avoid using subclasses at client sites d0ff3e70 librhash: Port to KWIML for ABI and integer type information 465a85fb librhash: Avoid signed left-shift overflow fc2cb74f librhash: Implement bswap_32 as a function even in strict C90 mode 0bd333bc librhash: Implement bswap_64 even in strict C90 mode 7189d62c librhash: Use __builtin_bswap{32,64} on Clang af7ebf8a librhash: Install COPYING file with CMake documentation bb01f20e librhash: Disable warnings to avoid changing 3rd party code 31bb727f librhash: Build the library within CMake 53048afa librhash: Remove source fragments not needed for CMake 5cb1b345 Merge branch 'upstream-librhash' into import-librhash ...
| * Port hash computation to cmCryptoHashBrad King2016-11-101-9/+4
| | | | | | | | | | Avoid using KWSys MD5 or `cm_sha2` and use the `cmCryptoHash` abstraction instead.
* | Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-10/+11
|/
* cmGlobalGenerator: Allow FindMakeProgram to failBrad King2016-10-201-3/+7
| | | | | Revise its signature to return `bool` so that it can fail and abort configuration early.
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|
* cmState: Port dependent code to new cmStateSnapshot nameStephen Kelly2016-10-191-7/+7
|
* cmState: Port dependent code to new cmStateDirectory nameStephen Kelly2016-10-191-2/+2
|
* cmState: Move CacheEntryType enum to separate namespaceStephen Kelly2016-10-191-4/+4
| | | | Port dependent code to the change.
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-14/+14
|
* Factor IDE folder name retrieval out into helper methodGregor Jasny2016-10-171-1/+1
| | | | | | Add a `cmGeneratorTarget::GetEffectiveFolderName` helper to abstract lookup of the `FOLDER` property in combination with checking for generator support of folders.
* cmLinkLineComputer: Move ComputeLinkLibs from cmLocalGeneratorStephen Kelly2016-10-101-4/+4
| | | | | | | | | | | | | | | Add a cmOutputConverter to the cmLinkLineComputer and factory methods to facilitate shell escapes. Add state to the cmLinkLineComputer to record whether outputting for response files or for watcom, to satisfy the cmOutputConverter API. These are constant for the lifetime of the cmLinkLineComputer, even when its functionality is extended in the future. This also keeps the signatures of cmLinkLineComputer relatively simple. Pass the cmComputeLinkInformation as a method parameter so that cmLinkLineComputer is free from target-specific state. An instance should be usable for all targets in a directory.
* cmLinkLineComputer: Extract from cmLocalGeneratorStephen Kelly2016-10-101-0/+14
| | | | | | | | | | | CMake has several classes which have too many responsibilities. cmLocalGenerator is one of them. Start to extract the link line computation. Create generator-specific implementations of the interface to account for generator-specific behavior. Unfortunately MSVC60 has different behavior to everything else and CMake still generates makefiles for it. Isolate it with MSVC60-specific names.
* cmGlobalGenerator: Add API to get settings from top-level cmMakefileStephen Kelly2016-10-061-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | At generate-time, definitions are sometimes read from a nearby cmMakefile, making the value directory-specific because they are read once per directory. Often however, the intention is more often to create a 'global' setting, such that the user writes for example: set(CMAKE_IMPORT_LIBRARY_SUFFIX something) once at the top level of their project. Many of these are also set by internal platform files, such as CMAKE_EXTRA_LINK_EXTENSIONS. The set() definitions are not really suitable for 'global' settings because they can be different for each directory, and code consuming the settings must assume they are different for each directory, and read it freshly each time with new allocations. CMake has other variable types which are global in scope, such as global properties, and cache variables. These are less convenient to populate for users, so establish a convention and API using the value as it is at the end of the top-level CMakeLists file.
* 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.
* cmGlobalGenerator: Optimize FindMakefile method with an indexBrad King2016-09-261-6/+17
| | | | | | | This method is used by directory get/set APIs. With the new `SUBDIRECTORIES` and `BUILDSYSTEM_TARGETS` methods projects may now make heavy use of these APIs to traverse their directory structure and process targets. Make this faster by indexing the directory lookups.
* Ninja: Refactor Fortran rejection logicBrad King2016-09-221-0/+10
| | | | | | | | | Delay rejection of Fortran until after we've determined the version of the `ninja` tool to be used. This will later allow us to enable Fortran support based on the version of ninja. While at it, make the rejection an immediate fatal error. Also provide a stack trace so readers know what code tried to enable Fortran.
* Convert: Avoid HOME_OUTPUT enum when converting to relative pathsStephen Kelly2016-09-191-1/+1
|
* Merge topic 'find-package-mode-fixes'Brad King2016-09-191-0/+1
|\ | | | | | | | | | | a098ca0d cmake: Fix --find-package mode link line output d9c600c5 cmGlobalGenerator: Fix use of uninitialized value in --find-package mode
| * cmGlobalGenerator: Fix use of uninitialized value in --find-package modeBrad King2016-09-161-0/+1
| |
* | cmGlobalGenerator: Refactor global target constructionBrad King2016-09-151-109/+95
| | | | | | | | | | | | Avoid using partially-constructed cmTarget instances. Collect the information about how to construct each target in a separate structure and then actually create each cmTarget with full construction.
* | cmGlobalGenerator: Split CreateDefaultGlobalTargets implementationBrad King2016-09-151-35/+51
|/ | | | | Divide this long method into multiple helpers each dedicated to one of the targets. This also avoids having to clear/re-use local structures.
* cmTarget: Construct with basic information up frontBrad King2016-09-141-2/+2
| | | | | Avoid having partially constructed cmTarget instances around, except for the special case of GLOBAL_TARGET construction.
* Avoid requiring default cmTarget constructor for map indexingBrad King2016-09-141-32/+52
| | | | | | The `std::map<>` index operator requires a default constructor on the value type. Avoid requiring a default constructor on `cmTarget` just for this purpose.
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-6/+14
|
* Convert: Replace trivial conversion with new methodStephen Kelly2016-08-271-2/+2
|
* Make sure unnused parameters are /*named*/Daniel Pfeifer2016-08-161-9/+12
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-26/+28
|
* Remove redundant arguments from fstream constructorsDaniel Pfeifer2016-06-141-1/+1
| | | | Don't pass the default value of the openmode parameter explicitly.
* cmGlobalGenerator: Don't use cmMakefile::IssueMessage after configureStephen Kelly2016-06-121-3/+4
|
* Simplify boolean expressionsDaniel Pfeifer2016-06-021-2/+1
| | | | | | 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.
* Pass arguments that are not modified as const&.Daniel Pfeifer2016-05-261-1/+1
| | | | | | | Use clang-tidy's performance-unnecessary-value-param checker to find value parameter declarations of expensive to copy types that are not modified inside the function. Ignore findings in kwsys. After applying the fix-its, manually change `const T&` to `T const&`.
* Merge topic 'standard-include-directories'Brad King2016-05-251-0/+20
|\ | | | | | | | | | | | | c1340827 Add a variable to specify language-wide system include directories 44199097 cmMakefile: Optimize AddSystemIncludeDirectories for empty set a896043b GHS: Compute include directories consistently with other generators
| * Add a variable to specify language-wide system include directoriesBrad King2016-05-251-0/+20
| | | | | | | | | | | | | | Create a `CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES` variable to specify system include directories for for `<LANG>` compiler command lines. This plays a role for include directories as the existing `CMAKE_<LANG>_STANDARD_LIBRARIES` variable does for link libraries.
* | Use enums defined in cmOutputConverter using their fully qualified name.Daniel Pfeifer2016-05-251-1/+1
|/ | | | | | | | | Mostly automated: values=("RelativeRoot" "NONE" "FULL" "HOME" "START" "HOME_OUTPUT" "START_OUTPUT" "OutputFormat" "UNCHANGED" "MAKERULE" "SHELL" "WATCOMQUOTE" "RESPONSE" "FortranFormat" "FortranFormatNone" "FortranFormatFixed" "FortranFormatFree") for i in "${values[@]}"; do git grep -l cmLocalGenerator::$i | xargs sed -i "s|cmLocalGenerator::$i|cmOutputConverter::$i|g"; done
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-1193/+825
| | | | | | | | | | | | | 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-44/+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/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Avoid depending on CMAKE_ROOT cache entry internally (#16015)Brad King2016-03-161-1/+1
| | | | | | Use cmSystemTools::GetCMakeRoot() which always knows the location of our resources. Do not depend on CMAKE_ROOT because the user could unset it from the cache.
* Diagnose recursive project/enable_language without crashing (#15999)Brad King2016-03-071-0/+21
| | | | | | | Calling `project()` or `enable_language()` from a toolchain file will infinitely recurse since those commands load the toolchain file. Diagnose and reject this case with an error message instead of crashing when the stack eventually overflows.
* Merge topic 'cmake-gui-reset-generator'Brad King2016-02-161-0/+7
|\ | | | | | | | | da490e11 cmake-gui: Fix cmState initialization when changing generators (#15959)
| * cmake-gui: Fix cmState initialization when changing generators (#15959)Brad King2016-02-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Refactoring in commit v3.3.0-rc1~29^2~1 (cmState: Host some state from the cmGlobalGenerator, 2015-05-24) moved storage of some generator traits over to cmState. However, it accidentally removed initialization of the values from the cmGlobalGenerator constructor. This is needed because generator subclasses update the settings in their constructors. Since a single cmState instance is shared across multiple build trees by cmake-gui, initializing the values in its constructor is not enough. Fix this by restoring the needed initializations to the cmGlobalGenerator constructor.
* | Improve internal generator target structure lookupBrad King2016-02-081-35/+14
| | | | | | | | | | | | | | | | In commit v3.5.0-rc1~272^2~6 (cmGlobalGenerator: Add FindGeneratorTarget API, 2015-10-25) a lookup was implemented via linear search. Replace it with an efficient data structure. Suggested-by: Stephen Kelly <steveire@gmail.com>
* | Fix internal target lookup performance regressionBrad King2016-02-081-33/+13
|/ | | | | | | | | | | Refactoring in commit v3.5.0-rc1~272^2~13 (cmGlobalGenerator: Remove direct storage of targets, 2015-10-25) replaced an efficient data structure mapping from target name to cmTarget instance with a linear search. Lookups through cmGlobalGenerator::FindTarget are done a lot. Restore the efficient mapping structure with a name indicating its purpose. Reported-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
* Merge topic 'reduce-allocations'Brad King2016-01-211-6/+6
|\ | | | | | | | | | | | | | | | | 70788e92 Remove temporary allocations when calling cmHasLiteral{Suf,Pre}fix. bd2384f5 Optimize cmMakefile::ExpandVariablesInStringNew. ad9394f4 Remove temporary allocations in cmMacroHelper::InvokeInitialPass. f9599ed4 Remove temporary allocations by extending the lifetime of the retval. 275f2a85 Remove temporary allocations when calling cmGeneratorTarget::GetName.
| * Remove temporary allocations by extending the lifetime of the retval.Milian Wolff2016-01-201-6/+6
| | | | | | | | | | | | | | | | | | | | See also Herb Sutter's article on the "most important const": http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/ When running the CMake daemon on the KDevelop build dir, this removes some hundreds of thousands of temporary allocations. This hotspot was found with heaptrack.
* | cmSystemTools: Rename OUTPUT_NORMAL to OUTPUT_FORWARD to clarify its purposeBrad King2016-01-191-1/+1
|/ | | | | | The OUTPUT_NORMAL value is not really "normal" and has only one caller. Rename it to OUTPUT_FORWARD to clarify that we are explicitly forwarding the output.