1. 19 Oct, 2016 2 commits
  2. 27 Sep, 2016 1 commit
    • Brad King's avatar
      Simplify CMake per-source license notices · 86578ecc
      Brad King authored
      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.
      86578ecc
  3. 08 Sep, 2016 1 commit
  4. 06 Sep, 2016 1 commit
    • Ben Keller's avatar
      install: Fix computed import prefix in export files when it is "/" · 290e4ce8
      Ben Keller authored
      When exporting from a project (with install(EXPORT ...)), the
      `<PROJECT>Targets.cmake` file contains logic for computing the
      `_IMPORT_PREFIX` from its own location.  This `_IMPORT_PREFIX` is then
      used in the `<PROJECT>Targets-<config>.cmake` file to generate the
      `IMPORTED_LOCATION_<CONFIG>`.  The generation unconditionally appends a
      "/" to `_IMPORT_PREFIX` before appending the rest of the path.  If
      `_IMPORT_PREFIX` is "/", then the `IMPORTED_LOCATION_<CONFIG>`
      properties all start with exactly two leading slashes ("//").
      
      Exactly two leading slashes is a special case in POSIX file paths, such
      that its interpretation is left up to the implementation.  This means
      that changing the path prefix from "/" to "//" should not be allowed.
      
      Since references to `_IMPORT_PREFIX` are always followed by a "/",
      simply check the value to replace "/" with "".
      290e4ce8
  5. 03 Sep, 2016 1 commit
  6. 16 Aug, 2016 1 commit
  7. 16 May, 2016 1 commit
    • Kitware Robot's avatar
      Revise C++ coding style using clang-format · d9fd2f54
      Kitware Robot authored
      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.
      d9fd2f54
  8. 09 May, 2016 1 commit
    • Brad King's avatar
      Remove `//------...` horizontal separator comments · 0ac18d40
      Brad King authored
      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.
      0ac18d40
  9. 06 May, 2016 1 commit
    • Brad King's avatar
      Isolate formatted streaming blocks with clang-format off/on · 64b55203
      Brad King authored
      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.
      64b55203
  10. 29 Apr, 2016 1 commit
    • Brad King's avatar
      Format include directive blocks and ordering with clang-format · e1c77472
      Brad King authored
      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's avatarDaniel Pfeifer <daniel@pfeifer-mail.de>
      e1c77472
  11. 21 Jan, 2016 1 commit
    • Andrey Pokrovskiy's avatar
      cmExportInstallFileGenerator: Fix crash in FindNamespaces · 7dbfdddf
      Andrey Pokrovskiy authored
      Refactoring merged by commit 9afbb733 (Merge topic
      'use-generator-target', 2015-10-20) in and around commit 381e7afd
      (cmExportSet: Store a cmGeneratorTarget, 2015-10-17) forgot to update
      one place in this method.  This leads to a crash in code such as
      
        add_library(A a.c)
        add_library(B b.c)
        target_link_libraries(B A)
        install(TARGETS B DESTINATION lib EXPORT ExpB)
        install(EXPORT ExpB DESTINATION lib/cmake/test)
        add_executable(C c.c)
        install(TARGETS C DESTINATION bin EXPORT ExpC)
      
      Fix the target name reference to avoid using an unpopulated Target
      pointer.
      7dbfdddf
  12. 20 Oct, 2015 1 commit
  13. 19 Oct, 2015 1 commit
  14. 18 Oct, 2015 7 commits
  15. 14 Oct, 2015 1 commit
    • Stephen Kelly's avatar
      cmState: Move TargetType enum from cmTarget. · eac15298
      Stephen Kelly authored
      Mostly automated:
      
       values=( "EXECUTABLE" "STATIC_LIBRARY" "SHARED_LIBRARY" "MODULE_LIBRARY" "OBJECT_LIBRARY" "UTILITY" "GLOBAL_TARGET" "INTERFACE_LIBRARY" "UNKNOWN_LIBRARY" "TargetType")
       for i in "${values[@]}"; do     git grep -l cmTarget::$i | xargs sed -i "s|cmTarget::$i|cmState::$i|g"; done
      eac15298
  16. 23 Aug, 2015 1 commit
  17. 05 Aug, 2015 2 commits
  18. 04 Aug, 2015 1 commit
  19. 30 Jul, 2015 1 commit
  20. 27 Jul, 2015 1 commit
  21. 03 May, 2015 1 commit
  22. 10 Mar, 2015 1 commit
  23. 11 Feb, 2015 2 commits
    • Brad King's avatar
      install: Allow generator expressions in TARGETS DESTINATION (#14317) · f30022eb
      Brad King authored
      This will allow per-config destinations for targets in EXPORT sets.
      Using multiple install(TARGETS) with separate CONFIGURATIONS is
      rejected as a target appearing more than once in an export set.
      Now instead one can write
      
       install(TARGETS foo EXPORT exp DESTINATION lib/$<CONFIG>)
      
      to get a single logical membership of the target in the export set
      while still having a per-config destination.
      f30022eb
    • Brad King's avatar
      cmInstallGenerator: Move GetDestination to subclasses that need it · f99991db
      Brad King authored
      The method is used only for EXPORT and TARGET install destinations.
      While at it, make it return a std::string by reference instead of a
      "const char*".
      f99991db
  24. 10 Feb, 2015 1 commit
  25. 11 Jan, 2015 1 commit
  26. 15 Dec, 2014 1 commit
    • Brad King's avatar
      install: Allow absolute EXPORT destination with relative targets (#15258) · dd089e08
      Brad King authored
      When install(EXPORT) is given an absolute destination we cannot compute
      the install prefix relative to the installed export file location.
      Previously we disallowed installation of targets in such exports with a
      relative destination, but did not enforce this for target property
      values besides the location of the main target file.  This could lead to
      broken installations when the EXPORT is installed to an absolute path
      but usage requirements are specified relative to the install prefix.
      
      Since an EXPORT installed to an absolute destination cannot be relocated
      we can just hard-code the value of CMAKE_INSTALL_PREFIX as the base for
      relative paths.  This will allow absolute install(EXPORT) destinations
      to work with relative destinations for targets and usage requirements.
      
      Extend the ExportImport test with a case covering this behavior.
      dd089e08
  27. 29 Nov, 2014 1 commit
    • Stephen Kelly's avatar
      Export: Disallow export of targets with INTERFACE_SOURCES · e1348056
      Stephen Kelly authored
      This can be allowed in the next release, but it needs to have some
      features present and tested such as
      
      * Ensuring that relative paths do not appear in the generated property.
      * Ensuring that paths to the source or build directories do not appear.
      * Generating a check in the file for CMake 3.1 or later so that the
          resulting property will be consumed.
      * Ensuring that any referenced targets are part of an export set and
          generating a check for them.
      * INSTALL_INTERFACE and BUILD_INTERFACE content.
      
      All of these checks are already done for INTERFACE_INCLUDE_DIRECTORIES,
      but it is too late to add them for INTERFACE_SOURCES for CMake 3.1.
      As the checks introduce some new error conditions, it is better to
      disallow exporting fully for this case and introduce proper error
      conditions later instead of policies.
      e1348056
  28. 08 Apr, 2014 1 commit
  29. 11 Mar, 2014 2 commits
  30. 08 Mar, 2014 1 commit