summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* Xcode: Control emission of EFFECTIVE_PLATFORM_NAMEGregor Jasny2017-01-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building with multiple SDKs within one project Xcode requires the usage of ${EFFECTIVE_PLATFORM_NAME} to put temporary and build outout into separate directories. For example an iOS device and simulator build use two different SDKs (iphoneos and iphonesimulator). In the past cmake tries to detect embedded toolchains that could possibly use simulators and emitted EFFECTIVE_PLATFORM_NAME (EPN) at the proper locations. In #16253 Mark noticed that if he uses macosx and iphoneos in combination the necessary EPN is not emitted. This is because CMake by default assumes macosx SDK which does not trigger EPN emission. The fist naive approach - enabling EPN unconditionally revealed that then the EPN leaks into generator expressions like $<TARGET_FILE:xxx> which might be a regression and thus is unacceptable. The next approach was to add an CMake property to enable EPN emission unconditionally. This solved the reported problem. But the EPN leakage also happened for the embedded toolchains already without anyone noticing. So the control property was turned into a tri-state one: * No definition: EPN is activated for embedded toolchains like before * ON: EPN is always emitted * OFF: EPN is never emitted That approach gives the user the chance to disable EPN for embedded toolchains and restores generator expression functionality for those. Closes: #16253
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-11/+11
|
* Introduce CM_UNORDERED_MAPDaniel Pfeifer2016-10-241-21/+4
| | | | | Avoid duplicating switch among std::unordered_map, cmsys::hash_map, and std::map.
* cmGlobalGenerator: Allow FindMakeProgram to failBrad King2016-10-201-1/+1
| | | | | Revise its signature to return `bool` so that it can fail and abort configuration early.
* cmState: Split auxiliary classes into separate filesStephen Kelly2016-10-191-1/+2
| | | | | | | Port dependents to the new locations as needed. Leave behind a cmState.h include in cmListFileCache to reduce noise. It is removed in a following commit.
* cmState: Port dependent code to new cmStateSnapshot nameStephen Kelly2016-10-191-2/+2
|
* cmState: Port dependent code to new cmStateDirectory nameStephen Kelly2016-10-191-2/+2
|
* Factor IDE folder name retrieval out into helper methodGregor Jasny2016-10-171-1/+2
| | | | | | 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-2/+3
| | | | | | | | | | | | | | | 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/+7
| | | | | | | | | | | 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.
* Merge topic 'nmake-encoding'Brad King2016-10-071-0/+7
|\ | | | | | | | | | | | | c666f8cb NMake: Use ANSI encoding for NMake Makefiles f00214aa cmGeneratedFileStream: Add optional encoding support bb1d3370 codecvt: Add class for encoding conversion
| * NMake: Use ANSI encoding for NMake MakefilesDāvis Mosāns2016-10-061-0/+7
| | | | | | | | | | Set ANSI encoding to cmGeneratedFileStream for use with NMake Makefile generator.
* | cmGlobalGenerator: Add API to get settings from top-level cmMakefileStephen Kelly2016-10-061-0/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | 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-12/+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-0/+10
| | | | | | | 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/+2
| | | | | | | | | 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.
* cmGlobalGenerator: Refactor global target constructionBrad King2016-09-151-11/+24
| | | | | | 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-0/+6
| | | | | Divide this long method into multiple helpers each dedicated to one of the targets. This also avoids having to clear/re-use local structures.
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-15/+17
|
* make sure to include cmConfigure.h before cmStandardIncludes.hDaniel Pfeifer2016-09-031-0/+2
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-8/+8
|
* Make C++ feature checks extensibleDaniel Pfeifer2016-06-271-2/+2
| | | | | | Turn the feature check for cxx11_unordered_map into a function such that we can use it for other features as well. Drop the 11 suffix, as we may want to check features from other standards.
* cmGlobalGenerator: Make IsMultiConfig() constTobias Hunger2016-06-011-1/+1
|
* Pass arguments that are not modified as const&.Daniel Pfeifer2016-05-261-2/+2
| | | | | | | 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&`.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-95/+109
| | | | | | | | | | | | | 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.
* 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>
* Drop Visual Studio 6 generatorBrad King2016-03-091-5/+0
| | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* Diagnose recursive project/enable_language without crashing (#15999)Brad King2016-03-071-0/+1
| | | | | | | 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.
* Improve internal generator target structure lookupBrad King2016-02-081-0/+6
| | | | | | | | 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-1/+17
| | | | | | | | | | | 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>
* cmGlobalGenerator: Remove map from cmTarget to cmGeneratorTargetStephen Kelly2015-10-271-14/+0
| | | | | | | The configure-time and generate-time types should be completely independent. Add ownership of cmGeneratorTarget instances to the cmLocalGenerator.
* cmLocalGenerator: Port Find method away from GetGeneratorTargetStephen Kelly2015-10-271-1/+3
| | | | Mirror the cmMakefile::FindTarget method.
* cmGlobalGenerator: Add FindGeneratorTarget APIStephen Kelly2015-10-271-0/+6
|
* cmTarget: Implement ALIAS in terms of name mappingStephen Kelly2015-10-271-12/+2
| | | | Remove mapping to cmTarget.
* cmGlobalGenerator: Remove direct storage of targetsStephen Kelly2015-10-271-4/+3
| | | | Find the target by looping when needed.
* cmGlobalGenerator: Move GeneratorTargetsType to usage site.Stephen Kelly2015-10-241-0/+4
|
* cmGlobalGenerator: Port IsRootOnlyTarget to cmGeneratorTarget.Stephen Kelly2015-10-201-1/+1
|
* cmExportTryCompileFileGenerator: Port to cmGeneratorTarget.Stephen Kelly2015-10-181-0/+3
|
* cmGlobalGenerator: Compute export() related classes early.Stephen Kelly2015-10-181-2/+2
| | | | Simplify CMP0024 handling.
* Genex: Port some access API to cmGeneratorTarget.Stephen Kelly2015-10-151-3/+3
|
* cmMakefile: Store container of cmExportBuildFileGenerators.Stephen Kelly2015-10-141-2/+5
| | | | | | | | | Set a cmLocalGenerator on each instance at compute time. That will soon be needed to access cmGeneratorTarget instances. If a cmExportBuildFileGenerator is processed early during configure time as a result of CMP0024 it must be removed from the list to process later at generate time.
* cmGeneratorTarget: Move GetSupportDirectory from cmTarget.Stephen Kelly2015-10-121-1/+1
|
* Merge topic 'refactor-computation'Brad King2015-10-061-1/+2
|\ | | | | | | | | | | | | | | | | | | | | 616f0311 cmGlobalGenerator: Move path computation to Compute. 9eea0486 cmGlobalGenerator: Do more computation at compute time. 2eca0559 cmGlobalGenerator: De-virtualize Compute(). 21f428f4 VisualStudio: Replace Compute override with AddExtraIDETargets override. a9588e90 VisualStudio10: Initialize the LongestSource at generate time. 4407eee0 cmGlobalGenerator: Call AddExtraIDETargets as a hook of Compute(). a09c545d Xcode: Extract a AddExtraIDETargets method.
| * cmGlobalGenerator: De-virtualize Compute().Stephen Kelly2015-10-051-1/+1
| | | | | | | | It now implements the NVI pattern.
| * cmGlobalGenerator: Call AddExtraIDETargets as a hook of Compute().Stephen Kelly2015-10-051-0/+1
| | | | | | | | Relieve the Xcode generator of having to reimplement Compute().
* | QtAutogen: Port global generator to cmGeneratorTarget.Stephen Kelly2015-10-051-1/+1
|/
* Merge topic 'fix-qtautogen-with-object-library-Ninja'Brad King2015-09-291-1/+0
|\ | | | | | | | | 9bc6eb8e cmGlobalGenerator: Initialize generator targets on construction (#15729)
| * cmGlobalGenerator: Initialize generator targets on construction (#15729)Stephen Kelly2015-09-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Ninja generator and Visual Studio generators are special-cased for the QtAutogen feature. In order to reduce the number of custom targets, the Visual Studio generators prefer to create custom commands instead, and in order to create appropriate Ninja files, generated rcc files are listed as byproducts. This requires the use of the GetConfigCommonSourceFiles API of the cmGeneratorTarget for those generators when initializing the autogen target. The initializer method is called from Compute() after the cmGeneratorTarget objects are created, however the initialization of the object directory occurs later in the InitGeneratorTargets method. That means that the resulting object locations are computed incorrectly and cached before the object directory is determined, so the generated buildsystem can not find the object files. The initialization of the object directory was split from the creation of cmGeneratorTarget instances in commit 0e0258c8 (cmGlobalGenerator: Split creation of generator object from initialization., 2015-07-25). The motivation for the split was to do only what is essential to do early in cases where cmGeneratorTargets need to be created at configure-time. That is required for the purpose of implementing policies CMP0024 and CMP0026, and for try_compile(LINK_LIBRARIES). However, the split was not really necessary. Compute the object directory in the cmGeneratorTarget constructor instead. The QtAutogen unit test already tests the use of TARGET_OBJECTS with AUTOMOC, and that test already passes on Ninja. The reason it already passes is that the QtAutogen target also uses the AUTORCC feature, and specifies several qrc files in its SOURCES. Later in the Compute algorithm (after the InitGeneratorTargets call), the rcc files are determined and target->AddSource is called. The AddSource call clears the previously mentioned cache of source files, causing it to be regenerated when next queried, this time taking account of the object directory. Extend the test suite with a new target which does not make use of AUTORCC with qrc files so that the test added alone would break without the fix in this commit.
* | Merge topic 'simplify-qt-autogen'Brad King2015-09-291-4/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1fe39020 QtAutogen: Port away from cmLocalGenerator. 59a729b2 QtAutogen: Split initializer class into separate file. 1e83a963 QtAutogen: Split initializer methods into separate class. 12f0e13c QtAutogen: Simplify generator initialization API. 65ff75d3 QtAutogen: Remove unnecessary dereference. 64b78c14 QtAutogen: Move Source initialization to prior loop. c3c20d3c QtAutogen: Add _automoc.cpp sources before initializing. 8b6ec29d QtAutogen: Move initialization condition to caller. 9470b056 QtAutogen: Move condition to prior loop. b7491b1c QtAutogen: Move condition to prior loop. e791c854 QtAutogen: Make some methods static. 6210ec64 QtAutogen: Make internal method private. a3ceb998 QtAutogen: Don't use members to initialize automoc targets. dced2fe1 QtAutogen: Rename variable. f9a77e76 QtAutogen: Don't use a member to store skipped uic files. c3633e7a QtAutogen: Add missing includes and forward declarations.
| * QtAutogen: Simplify generator initialization API.Stephen Kelly2015-09-261-4/+1
| |