summaryrefslogtreecommitdiff
path: root/Source/cmPolicies.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-169/+124
| | | | | | | | | | | | | 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-4/+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.
* 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.
* cmPolicies.cxx: Add missing include <ctype.h> for isdigit (#16066)Brad King2016-04-151-0/+1
|
* cmMakefile: Remove CMP0001 handling to callers.Stephen Kelly2015-07-251-0/+16
|
* cmPolicies: Store only state that users can set.Stephen Kelly2015-07-251-15/+1
| | | | | cmPolicies::PolicyMap does not need to store the REQUIRED_ALWAYS or REQUIRED_IF_USED states as they are statically determined.
* cmPolicies: Store all statuses in a single bitset.Stephen Kelly2015-06-071-13/+17
| | | | | | | | Currently there are an optimal number of policies (64) such that there are no wasted bits. When another policy is added, the cmPolicyMap will grow from 40 bytes to 80, and occupy 45. By storing all in a single bitset, we stay under the cache line size of 64 bytes until there are 512 policies in a range.
* cmPolicies: Replace UNDEFINED bitset with WARN bitset.Stephen Kelly2015-06-061-8/+5
| | | | Might as well use the existing concept.
* cmPolicies: Implement PolicyMap in terms of bitset.Stephen Kelly2015-05-041-4/+31
|
* cmPolicies: Implement abstraction for PolicyMap.Stephen Kelly2015-05-041-0/+22
| | | | Hide the detail that it is a std::map.
* cmPolicies: Make all API static.Stephen Kelly2015-05-041-1/+1
|
* cmPolicies: Remove unused DefinePolicy method.Stephen Kelly2015-05-041-10/+0
| | | | Policies are no longer defined at runtime.
* cmPolicies: Remove unused cmPolicy class.Stephen Kelly2015-05-041-332/+1
|
* cmPolicies: Loop over all policies using enum constants.Stephen Kelly2015-05-041-8/+8
|
* cmPolicies: Trivialize GetPolicyStatus method.Stephen Kelly2015-05-041-18/+5
| | | | | It would be possible to implement this with an XMacro and switch statement, but every codepath currently would still return WARN.
* cmPolicies: Use more-direct ID access.Stephen Kelly2015-05-041-2/+2
|
* cmPolicies: Implement in terms of public API.Stephen Kelly2015-05-041-1/+1
|
* cmPolicies: Make private method file-static.Stephen Kelly2015-05-041-27/+27
|
* cmPolicies: Implement short description access with XMacros.Stephen Kelly2015-05-041-15/+23
|
* cmPolicies: Implement version check with XMacro.Stephen Kelly2015-05-041-28/+27
|
* cmPolicies: Implement id to version with XMacro.Stephen Kelly2015-05-041-13/+21
|
* cmPolicies: Implement id to string conversion with XMacro.Stephen Kelly2015-05-041-25/+25
|
* cmPolicies: Implement more-compact IsPolicyNewerThan.Stephen Kelly2015-05-041-17/+6
|
* cmPolicies: Parse string for id conversion.Stephen Kelly2015-05-041-13/+37
| | | | Remove now-unused PolicyStringMap.
* cmPolicies: Make private method file-static.Stephen Kelly2015-05-031-31/+31
|
* cmPolicies: Remove runtime check for programming errors.Stephen Kelly2015-05-031-26/+0
|
* cmPolicies: Remove unused static data.Stephen Kelly2015-05-031-4/+0
|
* cmPolicies: Remove unused header.Stephen Kelly2015-05-031-1/+0
|
* if: Implement new IN_LIST operatorNils Gladitz2015-04-301-0/+5
|
* Revert "add_custom_command: Diagnose MAIN_DEPENDENCY limitation."Nils Gladitz2015-04-301-5/+0
| | | | | | | | | | | | This reverts commit 242c3966 (add_custom_command: Diagnose MAIN_DEPENDENCY limitation, 2015-03-09) and the follow up commit b372a99a (UseSWIG: Do not use MAIN_DEPENDENCY on custom commands, 2015-03-26). I misdiagnosed the underlying issue that prompted creation of policy CMP0057. The actual issue surfaces when a single custom command's MAIN_DEPENDENCY is listed in more than one target; this issue will have to be addressed independently.
* Link libraries by full path even in implicit directoriesBrad King2015-04-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | When CMP0003 was first introduced we wanted to link all libraries by full path. However, some projects had problems on platforms where find_library would find /usr/lib/libfoo.so when the project really wanted to link to /usr/lib/<arch>/libfoo.so and had been working by accident because pre-CMP0003 behavior used -lfoo to link. We first tried to address that in commit v2.6.0~440 (Teach find_library to avoid returning library paths in system directories, 2008-01-23) by returning just "foo" for libraries in implicit link directories. This caused problems for projects expecting find_library to always return a full path. We ended up using the solution in commit v2.6.0~366 (... switch library paths found in implicit link directories to use -l, 2008-01-31). However, the special case for libraries in implicit link directories has also proven problematic and confusing. Introduce policy CMP0060 to switch to linking all libraries by full path even if they are in implicit link directories. Explain in the policy documentation the factors that led to the original approach and now to this approach.
* Do not treat DEFINITIONS as a built-in directory propertyStephen Kelly2015-04-021-0/+5
| | | | | | | | Add policy CMP0059 to cover this change. The property has been deprecated since CMake 2.4 anyway. This will help clean up cmMakefile -- the DefineFlagsOrig member should not need to exist.
* Ninja: Add policy to require explicit custom command byproductsBrad King2015-03-201-0/+5
| | | | | | | | | | | | Add policy CMP0058 to avoid generating 'phony' ninja rules for unknown custom command dependencies. This requires projects to specify their custom command byproducts explicitly. With this requirement we no longer have to assume that unknown custom command dependencies are generated and can instead simply assume they are source files expected to exist when the build starts. This is particularly important in in-source builds. It is also helpful for out-of-source builds to allow Ninja to diagnose missing files before running custom command rules that depend on them.
* Merge topic 'cmAlgorithms-cleanup'Brad King2015-03-121-0/+1
|\ | | | | | | | | | | | | 95dd238f cmRemoveDuplicates: Fix iterator -> const_iterator. 4448f175 cmInstalledFile: Move Property implementation out of line. 7916d7ba Include cmAlgorithms where it is used.
| * Include cmAlgorithms where it is used.Stephen Kelly2015-03-111-0/+1
| |
* | add_custom_command: Diagnose MAIN_DEPENDENCY limitation.Nils Gladitz2015-03-091-0/+5
|/ | | | | The new policy CMP0057 diagnoses reuse of the same MAIN_DEPENDENCY across multiple custom commands.
* Use the cmDeleteAll algorithm instead of trivial raw loops.Stephen Kelly2015-01-131-7/+1
|
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-8/+8
| | | | All compilers hosting CMake support the std class.
* try_compile: Pass linker flags into test project (#14066)Brad King2014-12-031-0/+5
| | | | | | | | | | | | Copy CMAKE_EXE_LINKER_FLAGS into the test project generated by try_compile, just like we already copy CMAKE_<LANG>_FLAGS. Add CMake Policy CMP0056 to activate this behavior in a compatible way, but do not warn by default when the policy is not set since it will affect all try_compile calls. Extend the RunCMake.try_compile test with a case covering this behavior for each policy setting.
* break: Add policy CMP0055 to check calls strictlyGregor Jasny2014-11-251-0/+5
| | | | | | Reject break() without loop scope or any arguments. Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
* If: Introduce policy CMP0054 - don't dereference quoted variables in if()Nils Gladitz2014-09-111-0/+5
|
* EVIS: Add policy CMP0053Ben Boeckel2014-05-081-0/+5
| | | | | This policy switches between the old EVIS parser and the new, faster parser.
* Export: Disallow exported interface includes in src/build tree (#14592).Stephen Kelly2014-04-091-0/+6
| | | | | | | | | | | Allow directories in the source tree or build tree only if the install tree is a subdirectory of the source tree or build tree, as appropriate. Re-use the test files in the RunCMake.include_directories test to run in multiple scenarios. Bump the required CMake version in the test to 3.0 to ensure that the new policy warnings are emitted correctly.
* cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.Stephen Kelly2014-04-021-0/+5
| | | | Add policy CMP0051 to control this behavior.
* Remove some c_str() calls.Stephen Kelly2014-03-111-3/+3
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* add_custom_command: Disallow use of SOURCE signatures.Stephen Kelly2014-02-121-0/+5
| | | | Add CMP0050 to control this behavior.
* Add policy CMP0049 to avoid variable expansion in source listsStephen Kelly2014-02-121-0/+5
|
* Drop tweak version component from CMake PoliciesBrad King2014-02-041-69/+54
| | | | | | | | | | | | | Since commit v2.8.2~105^2~2 (Teach CMake Policies about tweak version component, 2010-04-23), cmPolicies has known how to handle a policy introduced in a tweak version. This was done back when we introduced policies with the current development date version and later updated it to the release version. Now we always introduce policies using the next expected release version and explicitly set the policy to test the NEW behavior. CMake Policies (or any other features) should never be introduced in a tweak (bugfix) release, so drop the infrastructure that allows this.
* project: Manage VERSION variablesBrad King2014-01-291-0/+5
| | | | | | | | | | | | | | | | Teach the project() command to set variables {PROJECT,<PROJECT-NAME>}_VERSION{,_MAJOR,_MINOR,_PATCH,_TWEAK} holding the project version number and its components. Add project() command option "VERSION" to specify the version explicitly, and default to the empty string when it is not given. Since this clears variables when no VERSION is given, this may change behavior for existing projects that set the version variables themselves prior to calling project(). Add policy CMP0048 for compatibility. Suggested-by: Alex Neundorf <neundorf@kde.org>