[Cmake-commits] CMake branch, next, updated. v2.8.12.1-5236-g3a42057

Stephen Kelly steveire at gmail.com
Mon Nov 18 04:18:21 EST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  3a42057bceaad243453e7b74aee6769db2406230 (commit)
       via  578aa8500ac9a6d767568cfe0d804320d7356c73 (commit)
       via  189568d0ef26700ad5f3c7a677afc2f68efbe79c (commit)
       via  d48d79946969d90a5cad1a60b698216c182f7ce1 (commit)
       via  8a5181968b1d10d6c7aa68d6753117ade59d415e (commit)
       via  96dbe190ae7df70257a3ce9a073c99b7b8fcc8b4 (commit)
       via  f09e9561e3ab333dcafe24464b9f3bf3b8f01cf5 (commit)
       via  0cfd94af34ac54aacf3d7bc6c380895ab28c61f5 (commit)
       via  af4f1c9e36b54cc43f88192da2c9f320e6522b11 (commit)
       via  ceabec2e8febb5e4e400578df9528b48b07f42c5 (commit)
       via  0d1b80d86f8fa7beea65519f72bab61b43737c50 (commit)
       via  0f0f75ce0e76aea28334095f92c63f5ee64d161f (commit)
       via  6d32e617df7df58ae451dbf04b6d1cfeeb0002ab (commit)
       via  fc66bf8a2fc8188620a3375e2bc00c620b3e33f6 (commit)
       via  3a75bf0b29d0afc694221d87ff48c391b7e860e0 (commit)
      from  075e8f795bbd04daf587ccbcc986acbba430fb9e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a42057bceaad243453e7b74aee6769db2406230
commit 3a42057bceaad243453e7b74aee6769db2406230
Merge: 075e8f7 578aa85
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 18 04:18:16 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Nov 18 04:18:16 2013 -0500

    Merge topic 'cross-compiling-toolchain-variables' into next
    
    578aa85 Remove tests.
    189568d shot in the dark.
    d48d799 Can't expect shortened libs.
    8a51819 Clear triple if not used.
    96dbe19 Diagnose bug.
    f09e956 Fix libz.so.
    0cfd94a Add error diagnosis.
    af4f1c9 Fix path quoting.
    ceabec2 Test installation to stage.
    0d1b80d Add tests
    0f0f75c Introduce CMAKE_STAGING_PREFIX variable.
    6d32e61 Use --sysroot when cross compiling.
    fc66bf8 Only look in the host for internal CMake file.
    3a75bf0 Allow toolchain files to specify an external toolchain.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=578aa8500ac9a6d767568cfe0d804320d7356c73
commit 578aa8500ac9a6d767568cfe0d804320d7356c73
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 18 10:16:48 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:29 2013 +0100

    Remove tests.

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 48554c2..6426b3a 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -250,9 +250,6 @@ if(BUILD_TESTING)
   ADD_TEST_MACRO(CompatibleInterface CompatibleInterface)
   ADD_TEST_MACRO(AliasTarget AliasTarget)
   ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary)
-  if(UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
-    ADD_TEST_MACRO(ToolchainSettings ToolchainSettings)
-  endif()
   set_tests_properties(EmptyLibrary PROPERTIES
     PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test")
   ADD_TEST_MACRO(CrossCompile CrossCompile)
diff --git a/Tests/ToolchainSettings/CMakeLists.txt b/Tests/ToolchainSettings/CMakeLists.txt
deleted file mode 100644
index cfab583..0000000
--- a/Tests/ToolchainSettings/CMakeLists.txt
+++ /dev/null
@@ -1,117 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12)
-cmake_policy(SET CMP0025 NEW)
-project(ToolchainSettings)
-
-# Wipe out the install tree
-add_custom_command(
-  OUTPUT ${CMAKE_BINARY_DIR}/CleanupProject
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/Consumer
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/Producer
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/sysroot
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/stage
-  )
-add_custom_target(CleanupTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/CleanupProject)
-set_property(
-  SOURCE ${CMAKE_BINARY_DIR}/CleanupProject
-  PROPERTY SYMBOLIC 1
-  )
-
-if(CMAKE_CONFIGURATION_TYPES)
-  set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
-else()
-  if(CMAKE_BUILD_TYPE)
-    set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}")
-  else()
-    set(NESTED_CONFIG_TYPE)
-  endif()
-endif()
-
-execute_process(COMMAND
-  "${CMAKE_CXX_COMPILER}" -dumpmachine
-  OUTPUT_VARIABLE triple
-  OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-
-if (triple AND NOT "${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}" MATCHES ${triple})
-  set(triple)
-else()
-  add_definitions(-DEXPECT_SHORT_LIBS=1)
-endif()
-
-macro(write_make_script name)
-  file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/Make${name}.sh"
-    "#!/bin/sh\n${CMAKE_MAKE_PROGRAM} install > \"${CMAKE_BINARY_DIR}/make_${name}_output\"\n"
-  )
-  file(COPY "${CMAKE_BINARY_DIR}/CMakeFiles/Make${name}.sh"
-    DESTINATION "${CMAKE_BINARY_DIR}"
-    FILE_PERMISSIONS
-      OWNER_READ OWNER_EXECUTE
-  )
-endmacro()
-
-write_make_script(Producer)
-
-# Build and install the producer.
-add_custom_command(
-  OUTPUT ${CMAKE_BINARY_DIR}/ProducerProject
-  COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
-    --build-and-test
-    ${CMAKE_SOURCE_DIR}/Producer
-    ${CMAKE_BINARY_DIR}/Producer
-    --build-noclean
-    --build-project Producer
-    --build-generator ${CMAKE_GENERATOR}
-    --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
-    --build-makeprogram "${CMAKE_BINARY_DIR}/MakeProducer.sh"
-    --build-options
-      -Dtriple=${triple}
-      -Dsysroot=${CMAKE_BINARY_DIR}/sysroot
-      -DCMAKE_VERBOSE_MAKEFILE=1
-  VERBATIM
-  )
-
-add_custom_target(ProducerTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/ProducerProject)
-add_dependencies(ProducerTarget CleanupTarget)
-set_property(
-  SOURCE ${CMAKE_BINARY_DIR}/ProducerProject
-  PROPERTY SYMBOLIC 1
-  )
-
-configure_file(${CMAKE_SOURCE_DIR}/${CMAKE_CXX_COMPILER_ID}-Toolchain.cmake.in
-               ${CMAKE_BINARY_DIR}/${CMAKE_CXX_COMPILER_ID}-Toolchain.cmake @ONLY)
-
-write_make_script(Consumer)
-
-# Build and install the consumer.
-add_custom_command(
-  OUTPUT ${CMAKE_BINARY_DIR}/ConsumerProject
-  COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
-   --build-and-test
-   ${CMAKE_SOURCE_DIR}/Consumer
-   ${CMAKE_BINARY_DIR}/Consumer
-   --build-noclean
-   --build-project Consumer
-   --build-generator ${CMAKE_GENERATOR}
-   --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
-   --build-makeprogram "${CMAKE_BINARY_DIR}/MakeConsumer.sh"
-   --build-options
-      -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/InstallationPrefix
-      -DCMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/${CMAKE_CXX_COMPILER_ID}-Toolchain.cmake
-      -Dtriple=${triple}
-      -DCMAKE_VERBOSE_MAKEFILE=1
-  VERBATIM
-  )
-add_custom_target(ToolchainSettingsTest ALL DEPENDS ${CMAKE_BINARY_DIR}/ConsumerProject)
-add_dependencies(ToolchainSettingsTest ProducerTarget)
-set_property(
-  SOURCE ${CMAKE_BINARY_DIR}/ConsumerProject
-  PROPERTY SYMBOLIC 1
-  )
-
-add_executable(ToolchainSettings main.cpp)
-target_compile_definitions(ToolchainSettings
-  PRIVATE
-    "-DMAKE_OUTPUT=\"${CMAKE_BINARY_DIR}/make_Consumer_output\""
-    "-DCOMPILER=\"${CMAKE_CXX_COMPILER}\""
-)
-add_dependencies(ToolchainSettings ToolchainSettingsTest)
diff --git a/Tests/ToolchainSettings/Clang-Toolchain.cmake.in b/Tests/ToolchainSettings/Clang-Toolchain.cmake.in
deleted file mode 100644
index 534b120..0000000
--- a/Tests/ToolchainSettings/Clang-Toolchain.cmake.in
+++ /dev/null
@@ -1,16 +0,0 @@
-
-set(CMAKE_SYSTEM_NAME Linux)
-
-set(CMAKE_SYSROOT "@CMAKE_BINARY_DIR@/sysroot")
-set(CMAKE_STAGING_PREFIX "@CMAKE_BINARY_DIR@/stage")
-
-set(CMAKE_C_COMPILER_TARGET @triple@)
-set(CMAKE_CXX_COMPILER_TARGET @triple@)
-
-set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
-set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
-
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
diff --git a/Tests/ToolchainSettings/Consumer/CMakeLists.txt b/Tests/ToolchainSettings/Consumer/CMakeLists.txt
deleted file mode 100644
index 8040e18..0000000
--- a/Tests/ToolchainSettings/Consumer/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-
-cmake_minimum_required (VERSION 2.8.12)
-project(Consumer)
-
-foreach(_lang C CXX)
-  set(_existing ${CMAKE_${_lang}_IMPLICIT_LINK_DIRECTORIES})
-  set(CMAKE_${_lang}_IMPLICIT_LINK_DIRECTORIES)
-  foreach(_dir ${_existing})
-    if(_dir MATCHES ${CMAKE_SYSROOT})
-      list(APPEND CMAKE_${_lang}_IMPLICIT_LINK_DIRECTORIES ${_dir})
-    endif()
-  endforeach()
-endforeach()
-
-message("CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES: ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
-
-find_package(ZLIB REQUIRED)
-set(CMAKE_CXX_LINK_FLAGS "-L\"${CMAKE_SYSROOT}/usr/lib/${triple}\"")
-
-add_executable(executable main.cpp)
-target_link_libraries(executable ${ZLIB_LIBRARIES})
-
-install(TARGETS executable DESTINATION bin)
diff --git a/Tests/ToolchainSettings/Consumer/main.cpp b/Tests/ToolchainSettings/Consumer/main.cpp
deleted file mode 100644
index a395ca9..0000000
--- a/Tests/ToolchainSettings/Consumer/main.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-
-#include "zlib.h"
-
-#ifndef FAKE_ZLIB
-#error Expected FAKE_ZLIB
-#endif
-
-int main(int ,char **)
-{
-  return fakezlib();
-}
diff --git a/Tests/ToolchainSettings/GNU-Toolchain.cmake.in b/Tests/ToolchainSettings/GNU-Toolchain.cmake.in
deleted file mode 100644
index 27b04cf..0000000
--- a/Tests/ToolchainSettings/GNU-Toolchain.cmake.in
+++ /dev/null
@@ -1,13 +0,0 @@
-
-set(CMAKE_SYSTEM_NAME Linux)
-
-set(CMAKE_SYSROOT "@CMAKE_BINARY_DIR@/sysroot")
-set(CMAKE_STAGING_PREFIX "@CMAKE_BINARY_DIR@/stage")
-
-set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
-set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
-
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
diff --git a/Tests/ToolchainSettings/Producer/CMakeLists.txt b/Tests/ToolchainSettings/Producer/CMakeLists.txt
deleted file mode 100644
index b4f1d3f..0000000
--- a/Tests/ToolchainSettings/Producer/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-cmake_minimum_required (VERSION 2.8.12)
-project(Producer)
-
-add_library(fakezlib SHARED fakezlib.cpp)
-set_property(TARGET fakezlib PROPERTY SOVERSION 1)
-set_property(TARGET fakezlib PROPERTY VERSION 1.2.7)
-set_property(TARGET fakezlib PROPERTY LIBRARY_OUTPUT_DIRECTORY ${sysroot}/lib/${triple})
-set_property(TARGET fakezlib PROPERTY OUTPUT_NAME z)
-
-file(MAKE_DIRECTORY "${sysroot}/usr/lib/${triple}/")
-add_custom_command(TARGET fakezlib POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E remove "${sysroot}/lib/${triple}/libz.so"
-  COMMAND ${CMAKE_COMMAND} -E create_symlink "${sysroot}/lib/${triple}/libz.so.1.2.7" "${sysroot}/usr/lib/${triple}/libz.so"
-)
-file(COPY "fakezlib.h" DESTINATION "${CMAKE_BINARY_DIR}")
-file(RENAME "${CMAKE_BINARY_DIR}/fakezlib.h" "${CMAKE_BINARY_DIR}/zlib.h")
-
-install(FILES "${CMAKE_BINARY_DIR}/zlib.h" DESTINATION "${sysroot}/usr/include/")
diff --git a/Tests/ToolchainSettings/Producer/fakezlib.cpp b/Tests/ToolchainSettings/Producer/fakezlib.cpp
deleted file mode 100644
index 0712ffe..0000000
--- a/Tests/ToolchainSettings/Producer/fakezlib.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#include "fakezlib.h"
-
-int fakezlib(void)
-{
-  return 0;
-}
diff --git a/Tests/ToolchainSettings/Producer/fakezlib.h b/Tests/ToolchainSettings/Producer/fakezlib.h
deleted file mode 100644
index 5d25657..0000000
--- a/Tests/ToolchainSettings/Producer/fakezlib.h
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#ifndef FAKE_ZLIB
-#define FAKE_ZLIB
-
-#define ZLIB_VERSION "1.2.7"
-
-int fakezlib(void);
-
-#endif
diff --git a/Tests/ToolchainSettings/main.cpp b/Tests/ToolchainSettings/main.cpp
deleted file mode 100644
index 64ea867..0000000
--- a/Tests/ToolchainSettings/main.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-
-#include <string>
-#include <fstream>
-#include <iostream>
-
-int main(void)
-{
-  std::ifstream f;
-  f.open(MAKE_OUTPUT);
-  if (!f.is_open())
-    {
-    return -1;
-    }
-  std::string content;
-
-  bool gotCompilation = false;
-  bool gotLink = false;
-  bool gotInstallation = false;
-  while (!f.eof())
-    {
-    std::string output;
-    getline(f,output);
-    if (output.find(COMPILER) != std::string::npos)
-      {
-      if (output.find("-sysroot") == std::string::npos)
-        {
-        std::cout << "Sysroot not used by compiler: " << output << std::endl;
-        return -1;
-        }
-      if (output.find(" -c ") != std::string::npos)
-        {
-        gotCompilation = true;
-        if (output.find(" -I") != std::string::npos)
-          {
-          std::cout << "Unexpected include: " << output << std::endl;
-          return -1;
-          }
-        if (output.find(" -isystem") != std::string::npos)
-          {
-          std::cout << "Unexpected include: " << output << std::endl;
-          return -1;
-          }
-        }
-      else
-        {
-        gotLink = true;
-#ifdef EXPECT_SHORT_LIBS
-        if (output.find("libz.so") != std::string::npos)
-          {
-          std::cout << "Unexpected library name: " << output << std::endl;
-          return -1;
-          }
-        if (output.find("-lz") == std::string::npos)
-          {
-          std::cout << "Expected -lz: " << output << std::endl;
-          return -1;
-          }
-#else
-        if (output.find("libz.so") == std::string::npos)
-          {
-          std::cout << "Expected library name: " << output << std::endl;
-          return -1;
-          }
-#endif
-        }
-      }
-    else if (output.find("-- Installing: ") != std::string::npos)
-      {
-      gotInstallation = true;
-      if (output.find("/stage/") == std::string::npos)
-        {
-        std::cout << "Install outside stage: " << output << std::endl;
-        return -1;
-        }
-      if (output.find("InstallationPrefix") != std::string::npos)
-        {
-        std::cout << "Install to prefix, not stage: " << output << std::endl;
-        return -1;
-        }
-      }
-    }
-  if (!gotCompilation)
-    {
-    std::cout << "Compilation step missing." << std::endl;
-    return -1;
-    }
-  if (!gotLink)
-    {
-    std::cout << "Link step missing." << std::endl;
-    return -1;
-    }
-  if (!gotInstallation)
-    {
-    std::cout << "Installation step missing." << std::endl;
-    return -1;
-    }
-  f.close();
-
-  return 0;
-}

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=189568d0ef26700ad5f3c7a677afc2f68efbe79c
commit 189568d0ef26700ad5f3c7a677afc2f68efbe79c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 19:05:04 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:29 2013 +0100

    shot in the dark.

diff --git a/Tests/ToolchainSettings/CMakeLists.txt b/Tests/ToolchainSettings/CMakeLists.txt
index 6705655..cfab583 100644
--- a/Tests/ToolchainSettings/CMakeLists.txt
+++ b/Tests/ToolchainSettings/CMakeLists.txt
@@ -31,7 +31,8 @@ execute_process(COMMAND
   OUTPUT_VARIABLE triple
   OUTPUT_STRIP_TRAILING_WHITESPACE
 )
-if (NOT CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES MATCHES ${triple})
+
+if (triple AND NOT "${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}" MATCHES ${triple})
   set(triple)
 else()
   add_definitions(-DEXPECT_SHORT_LIBS=1)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d48d79946969d90a5cad1a60b698216c182f7ce1
commit d48d79946969d90a5cad1a60b698216c182f7ce1
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 18:38:58 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:29 2013 +0100

    Can't expect shortened libs.

diff --git a/Tests/ToolchainSettings/CMakeLists.txt b/Tests/ToolchainSettings/CMakeLists.txt
index f9c0639..6705655 100644
--- a/Tests/ToolchainSettings/CMakeLists.txt
+++ b/Tests/ToolchainSettings/CMakeLists.txt
@@ -33,6 +33,8 @@ execute_process(COMMAND
 )
 if (NOT CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES MATCHES ${triple})
   set(triple)
+else()
+  add_definitions(-DEXPECT_SHORT_LIBS=1)
 endif()
 
 macro(write_make_script name)
diff --git a/Tests/ToolchainSettings/main.cpp b/Tests/ToolchainSettings/main.cpp
index 53282eb..64ea867 100644
--- a/Tests/ToolchainSettings/main.cpp
+++ b/Tests/ToolchainSettings/main.cpp
@@ -44,6 +44,7 @@ int main(void)
       else
         {
         gotLink = true;
+#ifdef EXPECT_SHORT_LIBS
         if (output.find("libz.so") != std::string::npos)
           {
           std::cout << "Unexpected library name: " << output << std::endl;
@@ -54,6 +55,13 @@ int main(void)
           std::cout << "Expected -lz: " << output << std::endl;
           return -1;
           }
+#else
+        if (output.find("libz.so") == std::string::npos)
+          {
+          std::cout << "Expected library name: " << output << std::endl;
+          return -1;
+          }
+#endif
         }
       }
     else if (output.find("-- Installing: ") != std::string::npos)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a5181968b1d10d6c7aa68d6753117ade59d415e
commit 8a5181968b1d10d6c7aa68d6753117ade59d415e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 18:32:18 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:29 2013 +0100

    Clear triple if not used.

diff --git a/Tests/ToolchainSettings/CMakeLists.txt b/Tests/ToolchainSettings/CMakeLists.txt
index 3f8f8df..f9c0639 100644
--- a/Tests/ToolchainSettings/CMakeLists.txt
+++ b/Tests/ToolchainSettings/CMakeLists.txt
@@ -31,6 +31,9 @@ execute_process(COMMAND
   OUTPUT_VARIABLE triple
   OUTPUT_STRIP_TRAILING_WHITESPACE
 )
+if (NOT CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES MATCHES ${triple})
+  set(triple)
+endif()
 
 macro(write_make_script name)
   file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/Make${name}.sh"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96dbe190ae7df70257a3ce9a073c99b7b8fcc8b4
commit 96dbe190ae7df70257a3ce9a073c99b7b8fcc8b4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 18:29:02 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:29 2013 +0100

    Diagnose bug.
    
    Presumably the dashboard machine does not use triples in the lib directories.

diff --git a/Tests/ToolchainSettings/Consumer/CMakeLists.txt b/Tests/ToolchainSettings/Consumer/CMakeLists.txt
index 139e14b..8040e18 100644
--- a/Tests/ToolchainSettings/Consumer/CMakeLists.txt
+++ b/Tests/ToolchainSettings/Consumer/CMakeLists.txt
@@ -12,6 +12,8 @@ foreach(_lang C CXX)
   endforeach()
 endforeach()
 
+message("CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES: ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
+
 find_package(ZLIB REQUIRED)
 set(CMAKE_CXX_LINK_FLAGS "-L\"${CMAKE_SYSROOT}/usr/lib/${triple}\"")
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f09e9561e3ab333dcafe24464b9f3bf3b8f01cf5
commit f09e9561e3ab333dcafe24464b9f3bf3b8f01cf5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 18:05:16 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:29 2013 +0100

    Fix libz.so.

diff --git a/Tests/ToolchainSettings/main.cpp b/Tests/ToolchainSettings/main.cpp
index 2460d23..53282eb 100644
--- a/Tests/ToolchainSettings/main.cpp
+++ b/Tests/ToolchainSettings/main.cpp
@@ -44,7 +44,7 @@ int main(void)
       else
         {
         gotLink = true;
-        if (output.find("zlib.so") != std::string::npos)
+        if (output.find("libz.so") != std::string::npos)
           {
           std::cout << "Unexpected library name: " << output << std::endl;
           return -1;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0cfd94af34ac54aacf3d7bc6c380895ab28c61f5
commit 0cfd94af34ac54aacf3d7bc6c380895ab28c61f5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 17:50:50 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:29 2013 +0100

    Add error diagnosis.

diff --git a/Tests/ToolchainSettings/main.cpp b/Tests/ToolchainSettings/main.cpp
index 0d3a6df..2460d23 100644
--- a/Tests/ToolchainSettings/main.cpp
+++ b/Tests/ToolchainSettings/main.cpp
@@ -24,6 +24,7 @@ int main(void)
       {
       if (output.find("-sysroot") == std::string::npos)
         {
+        std::cout << "Sysroot not used by compiler: " << output << std::endl;
         return -1;
         }
       if (output.find(" -c ") != std::string::npos)
@@ -31,10 +32,12 @@ int main(void)
         gotCompilation = true;
         if (output.find(" -I") != std::string::npos)
           {
+          std::cout << "Unexpected include: " << output << std::endl;
           return -1;
           }
         if (output.find(" -isystem") != std::string::npos)
           {
+          std::cout << "Unexpected include: " << output << std::endl;
           return -1;
           }
         }
@@ -43,10 +46,12 @@ int main(void)
         gotLink = true;
         if (output.find("zlib.so") != std::string::npos)
           {
+          std::cout << "Unexpected library name: " << output << std::endl;
           return -1;
           }
         if (output.find("-lz") == std::string::npos)
           {
+          std::cout << "Expected -lz: " << output << std::endl;
           return -1;
           }
         }
@@ -56,16 +61,29 @@ int main(void)
       gotInstallation = true;
       if (output.find("/stage/") == std::string::npos)
         {
+        std::cout << "Install outside stage: " << output << std::endl;
         return -1;
         }
       if (output.find("InstallationPrefix") != std::string::npos)
         {
+        std::cout << "Install to prefix, not stage: " << output << std::endl;
         return -1;
         }
       }
     }
-  if (!gotCompilation || !gotLink || !gotInstallation)
+  if (!gotCompilation)
     {
+    std::cout << "Compilation step missing." << std::endl;
+    return -1;
+    }
+  if (!gotLink)
+    {
+    std::cout << "Link step missing." << std::endl;
+    return -1;
+    }
+  if (!gotInstallation)
+    {
+    std::cout << "Installation step missing." << std::endl;
     return -1;
     }
   f.close();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af4f1c9e36b54cc43f88192da2c9f320e6522b11
commit af4f1c9e36b54cc43f88192da2c9f320e6522b11
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 17:30:41 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:28 2013 +0100

    Fix path quoting.

diff --git a/Tests/ToolchainSettings/Consumer/CMakeLists.txt b/Tests/ToolchainSettings/Consumer/CMakeLists.txt
index 86bff1c..139e14b 100644
--- a/Tests/ToolchainSettings/Consumer/CMakeLists.txt
+++ b/Tests/ToolchainSettings/Consumer/CMakeLists.txt
@@ -13,7 +13,7 @@ foreach(_lang C CXX)
 endforeach()
 
 find_package(ZLIB REQUIRED)
-set(CMAKE_CXX_LINK_FLAGS "-L${CMAKE_SYSROOT}/usr/lib/${triple}")
+set(CMAKE_CXX_LINK_FLAGS "-L\"${CMAKE_SYSROOT}/usr/lib/${triple}\"")
 
 add_executable(executable main.cpp)
 target_link_libraries(executable ${ZLIB_LIBRARIES})

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ceabec2e8febb5e4e400578df9528b48b07f42c5
commit ceabec2e8febb5e4e400578df9528b48b07f42c5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 17 17:27:03 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:28 2013 +0100

    Test installation to stage.

diff --git a/Tests/ToolchainSettings/CMakeLists.txt b/Tests/ToolchainSettings/CMakeLists.txt
index 2f6bee1..3f8f8df 100644
--- a/Tests/ToolchainSettings/CMakeLists.txt
+++ b/Tests/ToolchainSettings/CMakeLists.txt
@@ -89,7 +89,7 @@ add_custom_command(
    --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
    --build-makeprogram "${CMAKE_BINARY_DIR}/MakeConsumer.sh"
    --build-options
-      -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/Prefix1
+      -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/InstallationPrefix
       -DCMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/${CMAKE_CXX_COMPILER_ID}-Toolchain.cmake
       -Dtriple=${triple}
       -DCMAKE_VERBOSE_MAKEFILE=1
diff --git a/Tests/ToolchainSettings/main.cpp b/Tests/ToolchainSettings/main.cpp
index 6afcdae..0d3a6df 100644
--- a/Tests/ToolchainSettings/main.cpp
+++ b/Tests/ToolchainSettings/main.cpp
@@ -15,6 +15,7 @@ int main(void)
 
   bool gotCompilation = false;
   bool gotLink = false;
+  bool gotInstallation = false;
   while (!f.eof())
     {
     std::string output;
@@ -50,8 +51,20 @@ int main(void)
           }
         }
       }
+    else if (output.find("-- Installing: ") != std::string::npos)
+      {
+      gotInstallation = true;
+      if (output.find("/stage/") == std::string::npos)
+        {
+        return -1;
+        }
+      if (output.find("InstallationPrefix") != std::string::npos)
+        {
+        return -1;
+        }
+      }
     }
-  if (!gotCompilation || !gotLink)
+  if (!gotCompilation || !gotLink || !gotInstallation)
     {
     return -1;
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d1b80d86f8fa7beea65519f72bab61b43737c50
commit 0d1b80d86f8fa7beea65519f72bab61b43737c50
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 18 10:14:28 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:17:25 2013 +0100

    Add tests

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 6426b3a..48554c2 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -250,6 +250,9 @@ if(BUILD_TESTING)
   ADD_TEST_MACRO(CompatibleInterface CompatibleInterface)
   ADD_TEST_MACRO(AliasTarget AliasTarget)
   ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary)
+  if(UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+    ADD_TEST_MACRO(ToolchainSettings ToolchainSettings)
+  endif()
   set_tests_properties(EmptyLibrary PROPERTIES
     PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test")
   ADD_TEST_MACRO(CrossCompile CrossCompile)
diff --git a/Tests/ToolchainSettings/CMakeLists.txt b/Tests/ToolchainSettings/CMakeLists.txt
new file mode 100644
index 0000000..2f6bee1
--- /dev/null
+++ b/Tests/ToolchainSettings/CMakeLists.txt
@@ -0,0 +1,111 @@
+cmake_minimum_required(VERSION 2.8.12)
+cmake_policy(SET CMP0025 NEW)
+project(ToolchainSettings)
+
+# Wipe out the install tree
+add_custom_command(
+  OUTPUT ${CMAKE_BINARY_DIR}/CleanupProject
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/Consumer
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/Producer
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/sysroot
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/stage
+  )
+add_custom_target(CleanupTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/CleanupProject)
+set_property(
+  SOURCE ${CMAKE_BINARY_DIR}/CleanupProject
+  PROPERTY SYMBOLIC 1
+  )
+
+if(CMAKE_CONFIGURATION_TYPES)
+  set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
+else()
+  if(CMAKE_BUILD_TYPE)
+    set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}")
+  else()
+    set(NESTED_CONFIG_TYPE)
+  endif()
+endif()
+
+execute_process(COMMAND
+  "${CMAKE_CXX_COMPILER}" -dumpmachine
+  OUTPUT_VARIABLE triple
+  OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+macro(write_make_script name)
+  file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/Make${name}.sh"
+    "#!/bin/sh\n${CMAKE_MAKE_PROGRAM} install > \"${CMAKE_BINARY_DIR}/make_${name}_output\"\n"
+  )
+  file(COPY "${CMAKE_BINARY_DIR}/CMakeFiles/Make${name}.sh"
+    DESTINATION "${CMAKE_BINARY_DIR}"
+    FILE_PERMISSIONS
+      OWNER_READ OWNER_EXECUTE
+  )
+endmacro()
+
+write_make_script(Producer)
+
+# Build and install the producer.
+add_custom_command(
+  OUTPUT ${CMAKE_BINARY_DIR}/ProducerProject
+  COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
+    --build-and-test
+    ${CMAKE_SOURCE_DIR}/Producer
+    ${CMAKE_BINARY_DIR}/Producer
+    --build-noclean
+    --build-project Producer
+    --build-generator ${CMAKE_GENERATOR}
+    --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
+    --build-makeprogram "${CMAKE_BINARY_DIR}/MakeProducer.sh"
+    --build-options
+      -Dtriple=${triple}
+      -Dsysroot=${CMAKE_BINARY_DIR}/sysroot
+      -DCMAKE_VERBOSE_MAKEFILE=1
+  VERBATIM
+  )
+
+add_custom_target(ProducerTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/ProducerProject)
+add_dependencies(ProducerTarget CleanupTarget)
+set_property(
+  SOURCE ${CMAKE_BINARY_DIR}/ProducerProject
+  PROPERTY SYMBOLIC 1
+  )
+
+configure_file(${CMAKE_SOURCE_DIR}/${CMAKE_CXX_COMPILER_ID}-Toolchain.cmake.in
+               ${CMAKE_BINARY_DIR}/${CMAKE_CXX_COMPILER_ID}-Toolchain.cmake @ONLY)
+
+write_make_script(Consumer)
+
+# Build and install the consumer.
+add_custom_command(
+  OUTPUT ${CMAKE_BINARY_DIR}/ConsumerProject
+  COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
+   --build-and-test
+   ${CMAKE_SOURCE_DIR}/Consumer
+   ${CMAKE_BINARY_DIR}/Consumer
+   --build-noclean
+   --build-project Consumer
+   --build-generator ${CMAKE_GENERATOR}
+   --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
+   --build-makeprogram "${CMAKE_BINARY_DIR}/MakeConsumer.sh"
+   --build-options
+      -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/Prefix1
+      -DCMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/${CMAKE_CXX_COMPILER_ID}-Toolchain.cmake
+      -Dtriple=${triple}
+      -DCMAKE_VERBOSE_MAKEFILE=1
+  VERBATIM
+  )
+add_custom_target(ToolchainSettingsTest ALL DEPENDS ${CMAKE_BINARY_DIR}/ConsumerProject)
+add_dependencies(ToolchainSettingsTest ProducerTarget)
+set_property(
+  SOURCE ${CMAKE_BINARY_DIR}/ConsumerProject
+  PROPERTY SYMBOLIC 1
+  )
+
+add_executable(ToolchainSettings main.cpp)
+target_compile_definitions(ToolchainSettings
+  PRIVATE
+    "-DMAKE_OUTPUT=\"${CMAKE_BINARY_DIR}/make_Consumer_output\""
+    "-DCOMPILER=\"${CMAKE_CXX_COMPILER}\""
+)
+add_dependencies(ToolchainSettings ToolchainSettingsTest)
diff --git a/Tests/ToolchainSettings/Clang-Toolchain.cmake.in b/Tests/ToolchainSettings/Clang-Toolchain.cmake.in
new file mode 100644
index 0000000..534b120
--- /dev/null
+++ b/Tests/ToolchainSettings/Clang-Toolchain.cmake.in
@@ -0,0 +1,16 @@
+
+set(CMAKE_SYSTEM_NAME Linux)
+
+set(CMAKE_SYSROOT "@CMAKE_BINARY_DIR@/sysroot")
+set(CMAKE_STAGING_PREFIX "@CMAKE_BINARY_DIR@/stage")
+
+set(CMAKE_C_COMPILER_TARGET @triple@)
+set(CMAKE_CXX_COMPILER_TARGET @triple@)
+
+set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
+set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
diff --git a/Tests/ToolchainSettings/Consumer/CMakeLists.txt b/Tests/ToolchainSettings/Consumer/CMakeLists.txt
new file mode 100644
index 0000000..86bff1c
--- /dev/null
+++ b/Tests/ToolchainSettings/Consumer/CMakeLists.txt
@@ -0,0 +1,21 @@
+
+cmake_minimum_required (VERSION 2.8.12)
+project(Consumer)
+
+foreach(_lang C CXX)
+  set(_existing ${CMAKE_${_lang}_IMPLICIT_LINK_DIRECTORIES})
+  set(CMAKE_${_lang}_IMPLICIT_LINK_DIRECTORIES)
+  foreach(_dir ${_existing})
+    if(_dir MATCHES ${CMAKE_SYSROOT})
+      list(APPEND CMAKE_${_lang}_IMPLICIT_LINK_DIRECTORIES ${_dir})
+    endif()
+  endforeach()
+endforeach()
+
+find_package(ZLIB REQUIRED)
+set(CMAKE_CXX_LINK_FLAGS "-L${CMAKE_SYSROOT}/usr/lib/${triple}")
+
+add_executable(executable main.cpp)
+target_link_libraries(executable ${ZLIB_LIBRARIES})
+
+install(TARGETS executable DESTINATION bin)
diff --git a/Tests/ToolchainSettings/Consumer/main.cpp b/Tests/ToolchainSettings/Consumer/main.cpp
new file mode 100644
index 0000000..a395ca9
--- /dev/null
+++ b/Tests/ToolchainSettings/Consumer/main.cpp
@@ -0,0 +1,11 @@
+
+#include "zlib.h"
+
+#ifndef FAKE_ZLIB
+#error Expected FAKE_ZLIB
+#endif
+
+int main(int ,char **)
+{
+  return fakezlib();
+}
diff --git a/Tests/ToolchainSettings/GNU-Toolchain.cmake.in b/Tests/ToolchainSettings/GNU-Toolchain.cmake.in
new file mode 100644
index 0000000..27b04cf
--- /dev/null
+++ b/Tests/ToolchainSettings/GNU-Toolchain.cmake.in
@@ -0,0 +1,13 @@
+
+set(CMAKE_SYSTEM_NAME Linux)
+
+set(CMAKE_SYSROOT "@CMAKE_BINARY_DIR@/sysroot")
+set(CMAKE_STAGING_PREFIX "@CMAKE_BINARY_DIR@/stage")
+
+set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
+set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
diff --git a/Tests/ToolchainSettings/Producer/CMakeLists.txt b/Tests/ToolchainSettings/Producer/CMakeLists.txt
new file mode 100644
index 0000000..b4f1d3f
--- /dev/null
+++ b/Tests/ToolchainSettings/Producer/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+cmake_minimum_required (VERSION 2.8.12)
+project(Producer)
+
+add_library(fakezlib SHARED fakezlib.cpp)
+set_property(TARGET fakezlib PROPERTY SOVERSION 1)
+set_property(TARGET fakezlib PROPERTY VERSION 1.2.7)
+set_property(TARGET fakezlib PROPERTY LIBRARY_OUTPUT_DIRECTORY ${sysroot}/lib/${triple})
+set_property(TARGET fakezlib PROPERTY OUTPUT_NAME z)
+
+file(MAKE_DIRECTORY "${sysroot}/usr/lib/${triple}/")
+add_custom_command(TARGET fakezlib POST_BUILD
+  COMMAND ${CMAKE_COMMAND} -E remove "${sysroot}/lib/${triple}/libz.so"
+  COMMAND ${CMAKE_COMMAND} -E create_symlink "${sysroot}/lib/${triple}/libz.so.1.2.7" "${sysroot}/usr/lib/${triple}/libz.so"
+)
+file(COPY "fakezlib.h" DESTINATION "${CMAKE_BINARY_DIR}")
+file(RENAME "${CMAKE_BINARY_DIR}/fakezlib.h" "${CMAKE_BINARY_DIR}/zlib.h")
+
+install(FILES "${CMAKE_BINARY_DIR}/zlib.h" DESTINATION "${sysroot}/usr/include/")
diff --git a/Tests/ToolchainSettings/Producer/fakezlib.cpp b/Tests/ToolchainSettings/Producer/fakezlib.cpp
new file mode 100644
index 0000000..0712ffe
--- /dev/null
+++ b/Tests/ToolchainSettings/Producer/fakezlib.cpp
@@ -0,0 +1,7 @@
+
+#include "fakezlib.h"
+
+int fakezlib(void)
+{
+  return 0;
+}
diff --git a/Tests/ToolchainSettings/Producer/fakezlib.h b/Tests/ToolchainSettings/Producer/fakezlib.h
new file mode 100644
index 0000000..5d25657
--- /dev/null
+++ b/Tests/ToolchainSettings/Producer/fakezlib.h
@@ -0,0 +1,9 @@
+
+#ifndef FAKE_ZLIB
+#define FAKE_ZLIB
+
+#define ZLIB_VERSION "1.2.7"
+
+int fakezlib(void);
+
+#endif
diff --git a/Tests/ToolchainSettings/main.cpp b/Tests/ToolchainSettings/main.cpp
new file mode 100644
index 0000000..6afcdae
--- /dev/null
+++ b/Tests/ToolchainSettings/main.cpp
@@ -0,0 +1,61 @@
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+int main(void)
+{
+  std::ifstream f;
+  f.open(MAKE_OUTPUT);
+  if (!f.is_open())
+    {
+    return -1;
+    }
+  std::string content;
+
+  bool gotCompilation = false;
+  bool gotLink = false;
+  while (!f.eof())
+    {
+    std::string output;
+    getline(f,output);
+    if (output.find(COMPILER) != std::string::npos)
+      {
+      if (output.find("-sysroot") == std::string::npos)
+        {
+        return -1;
+        }
+      if (output.find(" -c ") != std::string::npos)
+        {
+        gotCompilation = true;
+        if (output.find(" -I") != std::string::npos)
+          {
+          return -1;
+          }
+        if (output.find(" -isystem") != std::string::npos)
+          {
+          return -1;
+          }
+        }
+      else
+        {
+        gotLink = true;
+        if (output.find("zlib.so") != std::string::npos)
+          {
+          return -1;
+          }
+        if (output.find("-lz") == std::string::npos)
+          {
+          return -1;
+          }
+        }
+      }
+    }
+  if (!gotCompilation || !gotLink)
+    {
+    return -1;
+    }
+  f.close();
+
+  return 0;
+}

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f0f75ce0e76aea28334095f92c63f5ee64d161f
commit 0f0f75ce0e76aea28334095f92c63f5ee64d161f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Nov 14 12:04:40 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:14:17 2013 +0100

    Introduce CMAKE_STAGING_PREFIX variable.
    
    This variable can be useful in cross-compiling contexts where the
    sysroot is read-only or where the sysroot should otherwise remain
    pristine.
    
    If the new CMAKE_STAGING_PREFIX variable is set, it is used instead
    of CMAKE_INSTALL_PREFIX when generating the installation rules in
    cmake_install.cmake.
    
    This way, the CMAKE_INSTALL_PREFIX variable
    always refers to the installation prefix on the target device, regardless
    of whether host==target.
    
    If any -rpath paths passed to the linker contain the CMAKE_STAGING_PREFIX,
    the matching path fragments are replaced with the CMAKE_INSTALL_PREFIX.
    Matching paths in the -rpath-link are not transformed.
    
    The cross-prefix usr-move workaround is assumed not to require extension
    regarding CMAKE_STAGING_PREFIX. The staging area is a single prefix, so
    there is no scope for cross-prefix symlinks. The CMAKE_INSTALL_PREFIX
    is still used to determine the workaround path, and that variable
    remains the relevant one even if CMAKE_STAGING_PREFIX is used. If the
    generated export files are deployed to the target, the workaround
    will still be in place, and still be employed if required.

diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index dd82b40..a46539f 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -110,6 +110,7 @@ Variables that Change Behavior
    /variable/CMAKE_PREFIX_PATH
    /variable/CMAKE_PROGRAM_PATH
    /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
+   /variable/CMAKE_STAGING_PREFIX
    /variable/CMAKE_SYSTEM_IGNORE_PATH
    /variable/CMAKE_SYSTEM_INCLUDE_PATH
    /variable/CMAKE_SYSTEM_LIBRARY_PATH
diff --git a/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst b/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst
index 91231b0..70d920b 100644
--- a/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst
+++ b/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst
@@ -3,11 +3,13 @@ CMAKE_FIND_NO_INSTALL_PREFIX
 
 Ignore the :variable:`CMAKE_INSTALL_PREFIX` when searching for assets.
 
-CMake adds the :variable:`CMAKE_INSTALL_PREFIX` to the
+CMake adds the :variable:`CMAKE_INSTALL_PREFIX` and the
+:variable:`CMAKE_STAGING_PREFIX` variable to the
 :variable:`CMAKE_SYSTEM_PREFIX_PATH` by default. This variable may be set
 on the command line to control that behavior.
 
 Set :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` to TRUE to tell find_package not
-to search in the :variable:`CMAKE_INSTALL_PREFIX` by default.  Note that the
+to search in the :variable:`CMAKE_INSTALL_PREFIX` or
+:variable:`CMAKE_STAGING_PREFIX` by default.  Note that the
 prefix may still be searched for other reasons, such as being the same prefix
 as the CMake installation, or for being a built-in system prefix.
diff --git a/Help/variable/CMAKE_STAGING_PREFIX.rst b/Help/variable/CMAKE_STAGING_PREFIX.rst
new file mode 100644
index 0000000..c4de7da
--- /dev/null
+++ b/Help/variable/CMAKE_STAGING_PREFIX.rst
@@ -0,0 +1,13 @@
+CMAKE_STAGING_PREFIX
+--------------------
+
+This variable may be set to a path to install to when cross-compiling. This can
+be useful if the path in :variable:`CMAKE_SYSROOT` is read-only, or otherwise
+should remain pristine.
+
+The CMAKE_STAGING_PREFIX location is also used as a search prefix by the ``find_*``
+commands. This can be controlled by setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX`
+variable.
+
+If any RPATH/RUNPATH entries passed to the linker contain the CMAKE_STAGING_PREFIX,
+the matching path fragments are replaced with the :variable:`CMAKE_INSTALL_PREFIX`.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 3152c2a..894e75d 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1902,6 +1902,10 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
   if(use_build_rpath || use_link_rpath)
     {
     std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+    const char *stagePath
+                  = this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
+    const char *installPrefix
+                  = this->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
     cmSystemTools::ConvertToUnixSlashes(rootPath);
     std::vector<std::string> const& rdirs = this->GetRuntimeSearchPath();
     for(std::vector<std::string>::const_iterator ri = rdirs.begin();
@@ -1916,6 +1920,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
           {
           d = d.substr(rootPath.size());
           }
+        else if (stagePath && d.find(stagePath) == 0)
+          {
+          std::string suffix = d.substr(strlen(stagePath));
+          d = installPrefix;
+          d += "/";
+          d += suffix;
+          cmSystemTools::ConvertToUnixSlashes(d);
+          }
         if(emitted.insert(d).second)
           {
           runtimeDirs.push_back(d);
@@ -1936,6 +1948,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
             {
             d = d.substr(rootPath.size());
             }
+          else if (stagePath && d.find(stagePath) == 0)
+            {
+            std::string suffix = d.substr(strlen(stagePath));
+            d = installPrefix;
+            d += "/";
+            d += suffix;
+            cmSystemTools::ConvertToUnixSlashes(d);
+            }
           if(emitted.insert(d).second)
             {
             runtimeDirs.push_back(d);
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 8c42811..233e0f9 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -440,6 +440,15 @@ void cmFindCommon::ComputeFinalPaths()
   // Expand list of paths inside all search roots.
   this->RerootPaths(paths);
 
+  if(const char* stagePrefix =
+      this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX"))
+    {
+    if (!this->Makefile->IsOn("CMAKE_FIND_NO_INSTALL_PREFIX"))
+      {
+      paths.push_back(stagePrefix);
+      }
+    }
+
   // Add a trailing slash to all paths to aid the search process.
   for(std::vector<std::string>::iterator i = paths.begin();
       i != paths.end(); ++i)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d2784a9..cf5798f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -370,6 +370,11 @@ void cmLocalGenerator::GenerateInstallRules()
     prefix = "/usr/local";
     }
 #endif
+  if (const char *stagingPrefix
+                  = this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX"))
+    {
+    prefix = stagingPrefix;
+    }
 
   // Compute the set of configurations.
   std::vector<std::string> configurationTypes;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d32e617df7df58ae451dbf04b6d1cfeeb0002ab
commit 6d32e617df7df58ae451dbf04b6d1cfeeb0002ab
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Apr 13 14:46:57 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:10:23 2013 +0100

    Use --sysroot when cross compiling.
    
    As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is
    introduced, which is never a list.
    
    The contents of this variable is passed to supporting compilers
    as --sysroot. It is also accounted for when processing implicit
    link directories reported by the compiler, and when generating
    RPATH information.

diff --git a/Help/command/FIND_XXX_ROOT.txt b/Help/command/FIND_XXX_ROOT.txt
index 407375a..7f80dcb 100644
--- a/Help/command/FIND_XXX_ROOT.txt
+++ b/Help/command/FIND_XXX_ROOT.txt
@@ -1,10 +1,17 @@
 The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more
 directories to be prepended to all other search directories.  This
 effectively "re-roots" the entire search under given locations.  By
-default it is empty.  It is especially useful when cross-compiling to
+default it is empty.
+
+The :variable:`CMAKE_SYSROOT` variable can also be used to specify exactly one
+directory to use as a prefix.  Setting :variable:`CMAKE_SYSROOT` also has other
+effects.  See the documentation for that variable for more.
+
+These variables are especially useful when cross-compiling to
 point to the root directory of the target environment and CMake will
 search there too.  By default at first the directories listed in
-CMAKE_FIND_ROOT_PATH and then the non-rooted directories will be
+CMAKE_FIND_ROOT_PATH are searched, then the :variable:`CMAKE_SYSROOT` directory is
+searched, and then the non-rooted directories will be
 searched.  The default behavior can be adjusted by setting
 |CMAKE_FIND_ROOT_PATH_MODE_XXX|.  This behavior can be manually
 overridden on a per-call basis.  By using CMAKE_FIND_ROOT_PATH_BOTH
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index ada9647..dd82b40 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -91,6 +91,7 @@ Variables that Change Behavior
    /variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName
    /variable/CMAKE_ERROR_DEPRECATED
    /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
+   /variable/CMAKE_SYSROOT
    /variable/CMAKE_FIND_LIBRARY_PREFIXES
    /variable/CMAKE_FIND_LIBRARY_SUFFIXES
    /variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE
diff --git a/Help/variable/CMAKE_SYSROOT.rst b/Help/variable/CMAKE_SYSROOT.rst
new file mode 100644
index 0000000..31ef60a
--- /dev/null
+++ b/Help/variable/CMAKE_SYSROOT.rst
@@ -0,0 +1,12 @@
+CMAKE_SYSROOT
+-------------
+
+Path to pass to the compiler in the --sysroot flag.
+
+The CMAKE_SYSROOT content is passed to the compiler in the --sysroot
+flag, if supported.  The path is also stripped from the RPATH/RUNPATH if
+necessary on installation.  The CMAKE_SYSROOT is also used to prefix
+paths searched by the ``find_*`` commands.
+
+This variable may only be set in a toolchain file. See the
+:variable:`CMAKE_TOOLCHAIN_FILE` variable for details.
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 504704d..f01255c 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -30,6 +30,7 @@ macro(__compiler_gnu lang)
   endif()
   set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+  set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
 
   # Older versions of gcc (< 4.5) contain a bug causing them to report a missing
   # header file as a warning if depfiles are enabled, causing check_header_file
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index d4644c3..3152c2a 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1901,6 +1901,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
     }
   if(use_build_rpath || use_link_rpath)
     {
+    std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+    cmSystemTools::ConvertToUnixSlashes(rootPath);
     std::vector<std::string> const& rdirs = this->GetRuntimeSearchPath();
     for(std::vector<std::string>::const_iterator ri = rdirs.begin();
         ri != rdirs.end(); ++ri)
@@ -1909,9 +1911,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
       // support or if using the link path as an rpath.
       if(use_build_rpath)
         {
-        if(emitted.insert(*ri).second)
+        std::string d = *ri;
+        if (!rootPath.empty() && d.find(rootPath) == 0)
           {
-          runtimeDirs.push_back(*ri);
+          d = d.substr(rootPath.size());
+          }
+        if(emitted.insert(d).second)
+          {
+          runtimeDirs.push_back(d);
           }
         }
       else if(use_link_rpath)
@@ -1924,9 +1931,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
            !cmSystemTools::IsSubDirectory(ri->c_str(), topSourceDir) &&
            !cmSystemTools::IsSubDirectory(ri->c_str(), topBinaryDir))
           {
-          if(emitted.insert(*ri).second)
+          std::string d = *ri;
+          if (!rootPath.empty() && d.find(rootPath) == 0)
+            {
+            d = d.substr(rootPath.size());
+            }
+          if(emitted.insert(d).second)
             {
-            runtimeDirs.push_back(*ri);
+            runtimeDirs.push_back(d);
             }
           }
         }
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 900f09f..bbfc427 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -433,6 +433,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       flag += tcDef;
       cmakeFlags.push_back(flag);
       }
+    if (const char *rootDef
+              = this->Makefile->GetDefinition("CMAKE_SYSROOT"))
+      {
+      std::string flag="-DCMAKE_SYSROOT=";
+      flag += rootDef;
+      cmakeFlags.push_back(flag);
+      }
     if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0)
       {
       fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 7beeda0..8c42811 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -138,16 +138,27 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
     {
     return;
     }
+  const char* sysroot =
+    this->Makefile->GetDefinition("CMAKE_SYSROOT");
   const char* rootPath =
     this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
-  if((rootPath == 0) || (strlen(rootPath) == 0))
+  const bool noSysroot = !sysroot || !*sysroot;
+  const bool noRootPath = !rootPath || !*rootPath;
+  if(noSysroot && noRootPath)
     {
     return;
     }
 
   // Construct the list of path roots with no trailing slashes.
   std::vector<std::string> roots;
-  cmSystemTools::ExpandListArgument(rootPath, roots);
+  if (rootPath)
+    {
+    cmSystemTools::ExpandListArgument(rootPath, roots);
+    }
+  if (sysroot)
+    {
+    roots.push_back(sysroot);
+    }
   for(std::vector<std::string>::iterator ri = roots.begin();
       ri != roots.end(); ++ri)
     {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 582ad0e..d2784a9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1047,6 +1047,8 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
       const char* compilerOptionTarget = 0;
       const char* compilerExternalToolchain = 0;
       const char* compilerOptionExternalToolchain = 0;
+      const char* compilerSysroot = 0;
+      const char* compilerOptionSysroot = 0;
       if(actualReplace == "CMAKE_${LANG}_COMPILER")
         {
         std::string arg1 = actualReplace + "_ARG1";
@@ -1067,6 +1069,12 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
               = this->Makefile->GetDefinition(
                 (std::string("CMAKE_") + lang +
                               "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN").c_str());
+        compilerSysroot
+              = this->Makefile->GetDefinition("CMAKE_SYSROOT");
+        compilerOptionSysroot
+              = this->Makefile->GetDefinition(
+                (std::string("CMAKE_") + lang +
+                              "_COMPILE_OPTIONS_SYSROOT").c_str());
         }
       if(actualReplace.find("${LANG}") != actualReplace.npos)
         {
@@ -1099,6 +1107,12 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
             ret += compilerOptionExternalToolchain;
             ret += this->EscapeForShell(compilerExternalToolchain, true);
             }
+          if (compilerSysroot && compilerOptionSysroot)
+            {
+            ret += " ";
+            ret += compilerOptionSysroot;
+            ret += this->EscapeForShell(compilerSysroot, true);
+            }
           return ret;
           }
         return replace;
@@ -1493,6 +1507,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
     return;
     }
 
+  std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+
   std::vector<std::string> implicitDirs;
   // Load implicit include directories for this language.
   std::string impDirVar = "CMAKE_";
@@ -1505,7 +1521,9 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
     for(std::vector<std::string>::const_iterator i = impDirVec.begin();
         i != impDirVec.end(); ++i)
       {
-      emitted.insert(*i);
+      std::string d = rootPath + *i;
+      cmSystemTools::ConvertToUnixSlashes(d);
+      emitted.insert(d);
       if (!stripImplicitInclDirs)
         {
         implicitDirs.push_back(*i);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc66bf8a2fc8188620a3375e2bc00c620b3e33f6
commit fc66bf8a2fc8188620a3375e2bc00c620b3e33f6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Nov 16 16:53:26 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:09:55 2013 +0100

    Only look in the host for internal CMake file.
    
    A toolchain file will generally contain the following lines:
    
     set(CMAKE_SYSROOT /path/to/sysroot)
     set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
    
    The find_file in Modules/CMakeDetermineCompilerId.cmake should not
    look in the sysroot or the CMAKE_FIND_ROOT_PATH entries, so
    add the parameter to control that in CMakeDetermineCompilerId.cmake.

diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 7fa4534..efb06c0 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -85,7 +85,7 @@ endfunction()
 #-----------------------------------------------------------------------------
 # Function to write the compiler id source file.
 function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
-  find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH)
+  find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   file(READ ${src_in} ID_CONTENT_IN)
   unset(src_in CACHE)
   string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a75bf0b29d0afc694221d87ff48c391b7e860e0
commit 3a75bf0b29d0afc694221d87ff48c391b7e860e0
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Aug 8 17:36:36 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 18 10:09:55 2013 +0100

    Allow toolchain files to specify an external toolchain.
    
    Clang can compile code, but uses the gcc tools for other tasks such
    as linking. The -gcc-toolchain option can be used for that, but
    generalize so that other compilers can be treated the same.
    
    If such a location is specified, use it as a hint for finding
    the binutils executables.

diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index c2af596..ada9647 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -234,6 +234,7 @@ Variables for Languages
    /variable/CMAKE_LANG_COMPILER_ID
    /variable/CMAKE_LANG_COMPILER_LOADED
    /variable/CMAKE_LANG_COMPILER
+   /variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN
    /variable/CMAKE_LANG_COMPILER_TARGET
    /variable/CMAKE_LANG_COMPILER_VERSION
    /variable/CMAKE_LANG_CREATE_SHARED_LIBRARY
diff --git a/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst b/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst
new file mode 100644
index 0000000..5c161dc
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst
@@ -0,0 +1,13 @@
+CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN
+----------------------------------------
+
+The external toolchain for cross-compiling, if supported.
+
+Some compiler toolchains do not ship their own auxilliary utilities such as
+archivers and linkers.  The compiler driver may support a command-line argument
+to specify the location of such tools.  CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN
+may be set to a path to a path to the external toolchain and will be passed
+to the compiler driver if supported.
+
+This variable may only be set in a toolchain file. See the
+:variable:`CMAKE_TOOLCHAIN_FILE` variable for details.
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 315d57e..829b6ff 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -43,7 +43,12 @@ if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC"
 
 # in all other cases search for ar, ranlib, etc.
 else()
-
+  if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN)
+    set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+  endif()
+  if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
+    set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+  endif()
   find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 
   find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index f0ea2f8..055aad6 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -31,5 +31,6 @@ else()
     set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
     set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
     set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-target ")
+    set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "-gcc-toolchain ")
   endmacro()
 endif()
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 5bf8ce5..900f09f 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -419,6 +419,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       flag += cDef;
       cmakeFlags.push_back(flag);
       }
+    if (const char *tcxxDef = this->Makefile->GetDefinition(
+                                  "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN"))
+      {
+      std::string flag="-DCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN=";
+      flag += tcxxDef;
+      cmakeFlags.push_back(flag);
+      }
+    if (const char *tcDef = this->Makefile->GetDefinition(
+                                    "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN"))
+      {
+      std::string flag="-DCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=";
+      flag += tcDef;
+      cmakeFlags.push_back(flag);
+      }
     if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0)
       {
       fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c308ba8..582ad0e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1045,6 +1045,8 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
       const char* compilerArg1 = 0;
       const char* compilerTarget = 0;
       const char* compilerOptionTarget = 0;
+      const char* compilerExternalToolchain = 0;
+      const char* compilerOptionExternalToolchain = 0;
       if(actualReplace == "CMAKE_${LANG}_COMPILER")
         {
         std::string arg1 = actualReplace + "_ARG1";
@@ -1057,6 +1059,14 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
               = this->Makefile->GetDefinition(
                 (std::string("CMAKE_") + lang +
                                           "_COMPILE_OPTIONS_TARGET").c_str());
+        compilerExternalToolchain
+              = this->Makefile->GetDefinition(
+                (std::string("CMAKE_") + lang +
+                                    "_COMPILER_EXTERNAL_TOOLCHAIN").c_str());
+        compilerOptionExternalToolchain
+              = this->Makefile->GetDefinition(
+                (std::string("CMAKE_") + lang +
+                              "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN").c_str());
         }
       if(actualReplace.find("${LANG}") != actualReplace.npos)
         {
@@ -1083,6 +1093,12 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
             ret += compilerOptionTarget;
             ret += compilerTarget;
             }
+          if (compilerExternalToolchain && compilerOptionExternalToolchain)
+            {
+            ret += " ";
+            ret += compilerOptionExternalToolchain;
+            ret += this->EscapeForShell(compilerExternalToolchain, true);
+            }
           return ret;
           }
         return replace;

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list