1. 21 Jan, 2019 3 commits
    • chuck cranor's avatar
      Compute implicit include directories from compiler output · 5990ecb7
      chuck cranor authored
       - CMakeParseImplicitIncludeInfo.cmake: new parser that extracts the
         compiler's include path from verbose output.  If the parser cannot
         parse the output, we fall back to the old behavior.  On osx we skip
         over framework directories (handled elsewhere).
       - CMakeDetermineCompilerABI.cmake:
           - use verbose flag in try_compile for ${src}
           - use new cmake_parse_implicit_include_info() to attempt extract
             implicit include directory path and if successful set
       - CMakeCCompiler.cmake.in and CMakeCXXCompiler.cmake.in - preserve
         CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES value between runs in
         the same way CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES is preserved
       - Tests/RunCMake/ParseImplicitIncludeInfo: tests for parse
         based on the older Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in.
         The test runs a set of verbose compiler outputs collected from
         various machines through the parser and checks the results.  New
         compiler files can be added by dropping input/output files in the
         ParseImplicitIncludeInfo/data subdirectory and then adding the new set
         of files to the ${targets} list in ParseImplicitIncludeInfo.cmake.
         There is a helper CMakeLists.txt in ParseImplicitIncludeInfo/data
         that can help with the generation of test input files.
         NOTE: the standard cmake pre-commit hook rejects verbose compiler
         output with trailing spaces... you have to manually edit them out.
         This shouldn't impact the test.
      Note that both the parser and the test code can use CMAKE_${LANG}_COMPILER_*
      variables such as ${CMAKE_CXX_COMPILER_ID} to decide how to parse
      verbose compiler output.  For the test code, this requires us to
      save the variables values in the test input files.
      Fixes: #16291
    • chuck cranor's avatar
      CMakeDetermineCompilerABI: set locale to C for try_compile() · d751d2d2
      chuck cranor authored
      Have CMakeDetermineCompilerABI set the locale to C before calling
      try_compile().  This is for the implicit include path parser to
      keep all the verbose compiler messages in English so we can parse
      it.   See #18784 for discussion.
    • Brad King's avatar
      CMakeDetermineCompilerABI: pass verbose flag during compilation · c765ae49
      Brad King authored
      Default to the same flag that is used for verbose link information, but
      provide another internal platform information variable to use a
      compilation-specific variant.  Populate it for CUDA where we use a
      different compiler for compilation and linking and therefore need
      different flags.
      Co-Author: Chuck Cranor <chuck@ece.cmu.edu>
  2. 16 Jan, 2019 1 commit
    • Fred Baksik's avatar
      GHS: Add Compiler ID detection · 72e0c115
      Fred Baksik authored
      -- Detect GHS compiler and version
         Detect ARCHITECTURE_ID for PPC / ARM / 86 targets
         Detect PLATFORM_ID for Integrity and Integrity178 platforms
         Using defines specified in the documents for the compilers: 201416 PPC / 201754 ARM / 201714 86
      -- Fallback C/CXX compiler ID to GHS if not otherwise detected and using GHS MULTI generator
         Works around issue with some GHS compilers not setting __ghs__ compiler define
      -- Tweak Compiler ID checking so major id of 002017 is not replaced with 217
      -- Prefer try_compile() library targets when testing for working GHS compilers
      -- Avoid CMake errors if reading past end of file for checking if file is PE executable
  3. 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.
  4. 03 Dec, 2014 1 commit
    • Brad King's avatar
      CMakeDetermineCompilerABI: Use normal linker flags in ABI project · a4f9b6f0
      Brad King authored
      When compiling the ABI detection test project, do not override
      CMAKE_EXE_LINKER_FLAGS completely.  The normally selected value of this
      variable may influence how the link is done and may be needed to be
      representative of how the calling project will be built.  Instead pass a
      variable that try_compile will reference as additional flags.  Leave
      this behavior of try_compile undocumented for now.
  5. 03 Sep, 2014 1 commit
  6. 21 Aug, 2014 1 commit
    • Brad King's avatar
      CMakeDetermineCompilerABI: Link with standard libraries on MSVC · 03ad8f28
      Brad King authored
      In commit v2.8.0~395 (Implicit link info for C, CXX, and Fortran,
      2009-07-23) we added a '-DCMAKE_${lang}_STANDARD_LIBRARIES=' flag to the
      try_compile used to build the ABI detection project.  It is needed when
      detecting the implicit libraries added by the GNU compiler on Windows
      (MinGW tools) to avoid contaminating the list with standard Windows
      libraries.  However, with MSVC we do not detect such implicit link
      libraries anyway, and for some target platforms (e.g. Windows Phone) we
      may need the standard libraries to link the ABI detection executable.
      Drop the flag when detecting the ABI using MSVC.
  7. 14 Apr, 2014 2 commits
  8. 09 Aug, 2013 1 commit
  9. 17 Jul, 2013 1 commit
    • Brad King's avatar
      Teach compiler ABI check to tolerate try_compile COPY_FILE failure · 4dc40185
      Brad King authored
      In CMakeDetermineCompilerABI we use try_compile with the COPY_FILE
      option to get a copy of the compiled binary used to detect the ABI
      information.  We already tolerate the case when compilation fails.
      However, when compilation appears to succeed but does not produce the
      expected executable the try_compile command immediately reports an error
      because the COPY_FILE fails.
      Tolerate COPY_FILE failure without stopping the overall configuration
      process by using the try_compile COPY_FILE_ERROR option to capture the
      error message.  Log the full error to CMakeError.log and simply report
      failure to detect the ABI as if compilation had failed.
      Teach the RunCMake.Configure test to cover this case and verify that the
      messages show up as expected both in stdout and in CMakeError.log.
  10. 11 Jun, 2013 1 commit
    • Stephen Kelly's avatar
      Add compiler target compile options. · 2d9ec1da
      Stephen Kelly authored
      For clang, this allows passing -target <triple> to the compiler, and
      for qcc, -V<arch> using toolchain files containing something like
       set(triple arm-linux-gnueabihf)
       set(CMAKE_C_COMPILER "/usr/bin/clang")
       set(CMAKE_C_COMPILER_TARGET ${triple})
       set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
       set(CMAKE_CXX_COMPILER_TARGET ${triple})
       set(arch gcc_ntoarmv7le)
       set(CMAKE_C_COMPILER /opt/qnx650/host/linux/x86/usr/bin/qcc)
       set(CMAKE_C_COMPILER_TARGET ${arch})
       set(CMAKE_CXX_COMPILER /opt/qnx650/host/linux/x86/usr/bin/QCC)
       set(CMAKE_CXX_COMPILER_TARGET ${arch})
      Both clang and qcc are inherently cross compiler( driver)s.
  11. 11 Dec, 2012 2 commits
    • Brad King's avatar
      OS X: Detect implicit linker framework search paths · cc676c3a
      Brad King authored
      Previously we hard-coded a list of implicit framework directories but
      did not account for CMAKE_OSX_SYSROOT or for changes to the list across
      OS X versions.  Instead we should automatically detect the framework
      directories for the active toolchain.
      The parent commit added the "-Wl,-v" option to ask "ld" to print its
      implicit directories.  It displays a block such as:
       Framework search paths:
      Parse this block to extract the list of framework directories.
      Detection may fail on toolchains that do not list their framework
      directories, such as older OS X linkers.  Always treat the paths
       <sdk>/Network/Library/Frameworks # Older OS X only
      as implicit.  Note that /System/Library/Frameworks should always be
      considered implicit so that frameworks CMake finds there will not
      override the SDK copies.
    • Brad King's avatar
      OS X: Detect implicit link directories on modern toolchains · 2dd67c7e
      Brad King authored
      We detect the implicit link directories for the toolchain by adding a
      flag to get verbose output from the compiler front-end while linking the
      ABI detection binary.  Newer OS X toolchains based on Clang do not add
      the implicit link directories with -L options to their internal
      invocation of "ld".  Instead they use a linker that comes with the
      toolchain and is already configured with the proper directories.
      Add the "-Wl,-v" option to ask "ld" to print its implicit directories.
      It displays them in a block such as:
       Library search paths:
      Parse this block to extract the implicit link directories.
      While at it, remove the checks introduced by commit efaf335b (Skip
      implicit link information on Xcode, 2009-07-23) and commit 5195a664
      (Skip implicit link info for multiple OS X archs, 2009-09-22).  Discard
      the non-system link directories added by Xcode.  Discard all detected
      implicit libraries in the multi-architecture case but keep the
      directories.  The directories are still useful without the libraries
      just to suppress addition of explicit -L options for them.
  12. 24 Aug, 2012 2 commits
    • Brad King's avatar
      Store ABI detection results in compiler information files · e5fee8a7
      Brad King authored
      Drop use of cache entry CMAKE_DETERMINE_<LANG>_ABI_COMPILED and replace
      it with variable CMAKE_<LANG>_ABI_COMPILED.  Since the grandparent
      commit this test result is specific to the version of CMake.  Store it
      in the version-specific compiler information files instead of
      CMakeCache.txt so testing can be re-done to meet the requirements of the
      current version of CMake even if another version of CMake was already
      used to configure the build tree.
    • Brad King's avatar
      Make platform information files specific to the CMake version · 7195aca5
      Brad King authored
      At the top of a build tree we configure inside the CMakeFiles directory
      files such as "CMakeSystem.cmake" and "CMake<lang>Compiler.cmake" to
      save information detected about the system and compilers in use.  The
      method of detection and the exact results store varies across CMake
      versions as things improve.  This leads to problems when loading files
      configured by a different version of CMake.  Previously we ignored such
      existing files only if the major.minor part of the CMake version
      component changed, and depended on the CMakeCache.txt to tell us the
      last version of CMake that wrote the files.  This led to problems if the
      user deletes the CMakeCache.txt or we add required information to the
      files in a patch-level release of CMake (still a "feature point" release
      by modern CMake versioning convention).
      Ensure that we always have version-consistent platform information files
      by storing them in a subdirectory named with the CMake version.  Every
      version of CMake will do its own system and compiler identification
      checks even when a build tree has already been configured by another
      version of CMake.  Stored results will not clobber those from other
      versions of CMake which may be run again on the same tree in the future.
      Loaded results will match what the system and language modules expect.
      Rename the undocumented variable CMAKE_PLATFORM_ROOT_BIN to
      CMAKE_PLATFORM_INFO_DIR to clarify its purpose.  The new variable points
      at the version-specific directory while the old variable did not.
  13. 13 Aug, 2012 2 commits
    • Kitware Robot's avatar
      Remove CMake-language block-end command arguments · 9db31162
      Kitware Robot authored
      Ancient versions of CMake required else(), endif(), and similar block
      termination commands to have arguments matching the command starting the
      block.  This is no longer the preferred style.
      Run the following shell code:
      for c in else endif endforeach endfunction endmacro endwhile; do
          echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
      done >convert.sed &&
      git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
      egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
      egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
      xargs -0 sed -i -f convert.sed &&
      rm convert.sed
    • Kitware Robot's avatar
      Convert CMake-language commands to lower case · 77543bde
      Kitware Robot authored
      Ancient CMake versions required upper-case commands.  Later command
      names became case-insensitive.  Now the preferred style is lower-case.
      Run the following shell code:
      cmake --help-command-list |
      grep -v "cmake version" |
      while read c; do
          echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
      done >convert.sed &&
      git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
      egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
      xargs -0 sed -i -f convert.sed &&
      rm convert.sed
  14. 05 Dec, 2011 1 commit
  15. 14 Sep, 2011 2 commits
  16. 08 Sep, 2011 1 commit
  17. 08 Jun, 2011 1 commit
  18. 09 Dec, 2010 1 commit
    • Brad King's avatar
      Detect object files in implicit link information · fe3f878f
      Brad King authored
      The NAG Fortran compiler implicitly passes object files by full path to
      the linker.  Teach CMakeParseImplicitLinkInfo to parse object files that
      match some tool-specific regular expression.
  19. 16 Sep, 2010 1 commit
  20. 01 Sep, 2010 1 commit
  21. 09 Aug, 2010 1 commit
  22. 06 May, 2010 1 commit
    • Brad King's avatar
      Load compiler information after configuring it · a443308c
      Brad King authored
      After configuring CMakeFiles/CMake<lang>Compiler.cmake in the build tree
      the second time (to store ABI information), include it immediately.
      This allows any logic and settings in the compiler information files to
      be used without duplicating it in CMakeDetermineCompilerABI.cmake.
      The change in commit "Use Fortran ABI detection results conservatively"
      (2010-05-05) needs this to use the same logic to set CMAKE_SIZEOF_VOID_P
      during first and later runs of CMake.
  23. 09 Oct, 2009 1 commit
  24. 06 Oct, 2009 1 commit
    • Brad King's avatar
      Log implicit link information parsing actions · b9850a61
      Brad King authored
      This commit teaches the CMAKE_PARSE_IMPLICIT_LINK_INFO function to log
      its actions.  We store the log in CMakeFiles/CMakeOutput.log at the top
      of the project build tree.  This will make diagnosis of implicit link
      information parsing problems easier.
  25. 01 Oct, 2009 1 commit
  26. 28 Sep, 2009 1 commit
    • Brad King's avatar
      Convert CMake non-find modules to BSD License · 3a666595
      Brad King authored
      This adds copyright/license notification blocks CMake's non-find
      modules.  Most of the modules had no notices at all.  Some had notices
      referring to the BSD license already.  This commit normalizes existing
      notices and adds missing notices.
  27. 22 Sep, 2009 1 commit
    • Brad King's avatar
      Skip implicit link info for multiple OS X archs · 5195a664
      Brad King authored
      Implicit link information contains architecture-specific libraries and
      directories.  The link information cannot be explicitly specified safely
      when CMAKE_OSX_ARCHITECTURES contains more than one architecture.
      As a result, we currently cannot support mixed-language C++/Fortran
      targets and OS X universal binaries simultaneously.  In order to avoid
      conflicts for simple C/C++ cases, we now simply skip detection of
      implicit link information in this case.
  28. 23 Jul, 2009 2 commits
    • Brad King's avatar
      BUG: Skip implicit link information on Xcode · efaf335b
      Brad King authored
      Xcode adds extra link directories that point at the build tree, so
      detection of implicit link directories is not reliable.  Since Fortran
      is not supported in Xcode we will not need implicit link information yet
    • Brad King's avatar
      ENH: Implicit link info for C, CXX, and Fortran · 07ea19ad
      Brad King authored
      This teaches CMake to detect implicit link information for C, C++, and
      Fortran compilers.  We detect the implicit linker search directories and
      implicit linker options for UNIX-like environments using verbose output
      from compiler front-ends.  We store results in new variables called
      The implicit libraries can contain linker flags as well as library
  29. 14 Apr, 2008 1 commit
  30. 21 Jan, 2008 1 commit