summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/try_compile.rst4
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/release/dev/FindCUDA-cublas_device.rst4
-rw-r--r--Help/release/dev/cpack-dmg-no-app-link.rst6
-rw-r--r--Help/release/dev/try_compile-custom-variables.rst7
-rw-r--r--Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst10
-rw-r--r--Modules/CPackDMG.cmake5
-rw-r--r--Modules/FindCUDA.cmake6
-rw-r--r--Modules/FindMatlab.cmake1
-rw-r--r--Modules/GetPrerequisites.cmake7
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx15
-rw-r--r--Source/cmCoreTryCompile.cxx143
-rw-r--r--Source/cmSystemTools.cxx2
-rw-r--r--Source/cmVariableWatch.cxx6
-rw-r--r--Tests/RunCMake/try_compile/PlatformVariables.cmake23
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake4
17 files changed, 161 insertions, 85 deletions
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 78b1bc7..7830deb 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -115,3 +115,7 @@ a build configuration.
Set the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable to specify
the type of target used for the source file signature.
+
+Set the :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable to specify
+variables that must be propagated into the test project. This variable is
+meant for use only in toolchain files.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index b8c8bea..85b8eae 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -298,6 +298,7 @@ Variables that Control the Build
/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG
/variable/CMAKE_STATIC_LINKER_FLAGS
/variable/CMAKE_TRY_COMPILE_CONFIGURATION
+ /variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
/variable/CMAKE_TRY_COMPILE_TARGET_TYPE
/variable/CMAKE_USE_RELATIVE_PATHS
/variable/CMAKE_VISIBILITY_INLINES_HIDDEN
diff --git a/Help/release/dev/FindCUDA-cublas_device.rst b/Help/release/dev/FindCUDA-cublas_device.rst
new file mode 100644
index 0000000..2ceed60
--- /dev/null
+++ b/Help/release/dev/FindCUDA-cublas_device.rst
@@ -0,0 +1,4 @@
+FindCUDA-cublas_device
+----------------------
+
+* The :module:`FindCUDA` module learned to find the ``cublas_device`` library.
diff --git a/Help/release/dev/cpack-dmg-no-app-link.rst b/Help/release/dev/cpack-dmg-no-app-link.rst
new file mode 100644
index 0000000..46101a5
--- /dev/null
+++ b/Help/release/dev/cpack-dmg-no-app-link.rst
@@ -0,0 +1,6 @@
+cpack-dmg-no-app-link
+---------------------
+
+* The :module:`CPackDMG` module learned a new option to tell the CPack
+ ``DragNDrop`` generaor to skip the ``/Applications`` symlink.
+ See the :variable:`CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK` variable.
diff --git a/Help/release/dev/try_compile-custom-variables.rst b/Help/release/dev/try_compile-custom-variables.rst
new file mode 100644
index 0000000..539b364
--- /dev/null
+++ b/Help/release/dev/try_compile-custom-variables.rst
@@ -0,0 +1,7 @@
+try_compile-custom-variables
+----------------------------
+
+* A :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable was
+ added for use by toolchain files to specify platform-specific
+ variables that must be propagated by the :command:`try_compile`
+ command into test projects.
diff --git a/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst b/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst
new file mode 100644
index 0000000..8e43465
--- /dev/null
+++ b/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst
@@ -0,0 +1,10 @@
+CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
+------------------------------------
+
+List of variables that the :command:`try_compile` command source file signature
+must propagate into the test project in order to target the same platform as
+the host project.
+
+This variable should not be set by project code. It is meant to be set by
+CMake's platform information modules for the current toolchain, or by a
+toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
index 1959f22..929b2f6 100644
--- a/Modules/CPackDMG.cmake
+++ b/Modules/CPackDMG.cmake
@@ -46,6 +46,11 @@
# CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is
# installed. By default no background image is set.
#
+# .. variable:: CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK
+#
+# Default behaviour is to include a symlink to ``/Applications`` in the DMG.
+# Set this option to ``ON`` to avoid adding the symlink.
+#
# .. variable:: CPACK_DMG_SLA_DIR
#
# Directory where license and menu files for different languages are stored.
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 2979f0f..48bb554 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -549,6 +549,7 @@ macro(cuda_unset_include_and_libraries)
endif()
unset(CUDA_cudart_static_LIBRARY CACHE)
unset(CUDA_cublas_LIBRARY CACHE)
+ unset(CUDA_cublas_device_LIBRARY CACHE)
unset(CUDA_cublasemu_LIBRARY CACHE)
unset(CUDA_cufft_LIBRARY CACHE)
unset(CUDA_cufftemu_LIBRARY CACHE)
@@ -854,6 +855,7 @@ if(NOT CUDA_VERSION VERSION_LESS "3.2")
endif()
endif()
if(CUDA_VERSION VERSION_GREATER "5.0")
+ find_cuda_helper_libs(cublas_device)
# In CUDA 5.5 NPP was splitted onto 3 separate libraries.
find_cuda_helper_libs(nppc)
find_cuda_helper_libs(nppi)
@@ -872,7 +874,7 @@ if (CUDA_BUILD_EMULATION)
set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublasemu_LIBRARY})
else()
set(CUDA_CUFFT_LIBRARIES ${CUDA_cufft_LIBRARY})
- set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY})
+ set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY})
endif()
########################
@@ -1803,7 +1805,7 @@ macro(CUDA_ADD_CUBLAS_TO_TARGET target)
if (CUDA_BUILD_EMULATION)
target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
else()
- target_link_libraries(${target} ${CUDA_cublas_LIBRARY})
+ target_link_libraries(${target} ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY})
endif()
endmacro()
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 8aa0c11..956dad2 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -229,6 +229,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS)
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2016a=9.0"
"R2015b=8.6"
"R2015a=8.5"
"R2014b=8.4"
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index dd294f4..375349f 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -663,20 +663,27 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
set(gp_cmd_paths ${gp_cmd_paths}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]/../../VC/bin"
"$ENV{VS140COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]/../../VC/bin"
"$ENV{VS120COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]/../../VC/bin"
"$ENV{VS110COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/bin"
"$ENV{VS100COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/../../VC/bin"
"$ENV{VS90COMNTOOLS}/../../VC/bin"
"C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/bin"
"$ENV{VS80COMNTOOLS}/../../VC/bin"
"C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
"C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]/../../VC7/bin"
"$ENV{VS71COMNTOOLS}/../../VC7/bin"
"C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
"C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 447d29f..86b016b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 5)
-set(CMake_VERSION_PATCH 20160525)
+set(CMake_VERSION_PATCH 20160526)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 9576eff..f4379c1 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -305,6 +305,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
? this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT")
: "";
+ const bool cpack_dmg_disable_applications_symlink =
+ this->IsOn("CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK");
+
// only put license on dmg if is user provided
if (!cpack_license_file.empty() &&
cpack_license_file.find("CPack.GenericLicense.txt") !=
@@ -323,11 +326,13 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
staging << src_dir;
// Add a symlink to /Applications so users can drag-and-drop the bundle
- // into it
- std::ostringstream application_link;
- application_link << staging.str() << "/Applications";
- cmSystemTools::CreateSymlink("/Applications",
- application_link.str().c_str());
+ // into it unless this behaviour was disabled
+ if (!cpack_dmg_disable_applications_symlink) {
+ std::ostringstream application_link;
+ application_link << staging.str() << "/Applications";
+ cmSystemTools::CreateSymlink("/Applications",
+ application_link.str().c_str());
+ }
// Optionally add a custom volume icon ...
if (!cpack_package_icon.empty()) {
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 9d83624..0149fdf 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -20,6 +20,30 @@
#include <assert.h>
+static std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN =
+ "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN";
+static std::string const kCMAKE_C_COMPILER_TARGET = "CMAKE_C_COMPILER_TARGET";
+static std::string const kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN =
+ "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN";
+static std::string const kCMAKE_CXX_COMPILER_TARGET =
+ "CMAKE_CXX_COMPILER_TARGET";
+static std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS";
+static std::string const kCMAKE_LINK_SEARCH_END_STATIC =
+ "CMAKE_LINK_SEARCH_END_STATIC";
+static std::string const kCMAKE_LINK_SEARCH_START_STATIC =
+ "CMAKE_LINK_SEARCH_START_STATIC";
+static std::string const kCMAKE_OSX_ARCHITECTURES = "CMAKE_OSX_ARCHITECTURES";
+static std::string const kCMAKE_OSX_DEPLOYMENT_TARGET =
+ "CMAKE_OSX_DEPLOYMENT_TARGET";
+static std::string const kCMAKE_OSX_SYSROOT = "CMAKE_OSX_SYSROOT";
+static std::string const kCMAKE_POSITION_INDEPENDENT_CODE =
+ "CMAKE_POSITION_INDEPENDENT_CODE";
+static std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT";
+static std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES =
+ "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES";
+static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
+ "CMAKE_TRY_COMPILE_PLATFORM_VARIABLES";
+
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
bool isTryRun)
{
@@ -383,76 +407,51 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fname.c_str());
}
- /* for the TRY_COMPILEs we want to be able to specify the architecture.
- So the user can set CMAKE_OSX_ARCHITECTURES to i386;ppc and then set
- CMAKE_TRY_COMPILE_OSX_ARCHITECTURES first to i386 and then to ppc to
- have the tests run for each specific architecture. Since
- cmLocalGenerator doesn't allow building for "the other"
- architecture only via CMAKE_OSX_ARCHITECTURES.
- */
- if (this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_OSX_ARCHITECTURES") !=
- 0) {
- std::string flag = "-DCMAKE_OSX_ARCHITECTURES=";
- flag += this->Makefile->GetSafeDefinition(
- "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES");
- cmakeFlags.push_back(flag);
- } else if (this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES") != 0) {
- std::string flag = "-DCMAKE_OSX_ARCHITECTURES=";
- flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
- cmakeFlags.push_back(flag);
- }
- /* on APPLE also pass CMAKE_OSX_SYSROOT to the try_compile */
- if (this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT") != 0) {
- std::string flag = "-DCMAKE_OSX_SYSROOT=";
- flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_SYSROOT");
- cmakeFlags.push_back(flag);
- }
- /* on APPLE also pass CMAKE_OSX_DEPLOYMENT_TARGET to the try_compile */
- if (this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET") != 0) {
- std::string flag = "-DCMAKE_OSX_DEPLOYMENT_TARGET=";
- flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
- cmakeFlags.push_back(flag);
- }
- if (const char* cxxDef =
- this->Makefile->GetDefinition("CMAKE_CXX_COMPILER_TARGET")) {
- std::string flag = "-DCMAKE_CXX_COMPILER_TARGET=";
- flag += cxxDef;
- cmakeFlags.push_back(flag);
- }
- if (const char* cDef =
- this->Makefile->GetDefinition("CMAKE_C_COMPILER_TARGET")) {
- std::string flag = "-DCMAKE_C_COMPILER_TARGET=";
- 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 (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");
- }
- if (const char* lssDef =
- this->Makefile->GetDefinition("CMAKE_LINK_SEARCH_START_STATIC")) {
- fprintf(fout, "set(CMAKE_LINK_SEARCH_START_STATIC \"%s\")\n", lssDef);
- }
- if (const char* lssDef =
- this->Makefile->GetDefinition("CMAKE_LINK_SEARCH_END_STATIC")) {
- fprintf(fout, "set(CMAKE_LINK_SEARCH_END_STATIC \"%s\")\n", lssDef);
+ // Forward a set of variables to the inner project cache.
+ {
+ std::set<std::string> vars;
+ vars.insert(kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN);
+ vars.insert(kCMAKE_C_COMPILER_TARGET);
+ vars.insert(kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN);
+ vars.insert(kCMAKE_CXX_COMPILER_TARGET);
+ vars.insert(kCMAKE_ENABLE_EXPORTS);
+ vars.insert(kCMAKE_LINK_SEARCH_END_STATIC);
+ vars.insert(kCMAKE_LINK_SEARCH_START_STATIC);
+ vars.insert(kCMAKE_OSX_ARCHITECTURES);
+ vars.insert(kCMAKE_OSX_DEPLOYMENT_TARGET);
+ vars.insert(kCMAKE_OSX_SYSROOT);
+ vars.insert(kCMAKE_POSITION_INDEPENDENT_CODE);
+ vars.insert(kCMAKE_SYSROOT);
+
+ if (const char* varListStr = this->Makefile->GetDefinition(
+ kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) {
+ std::vector<std::string> varList;
+ cmSystemTools::ExpandListArgument(varListStr, varList);
+ vars.insert(varList.begin(), varList.end());
+ }
+
+ /* for the TRY_COMPILEs we want to be able to specify the architecture.
+ So the user can set CMAKE_OSX_ARCHITECTURES to i386;ppc and then set
+ CMAKE_TRY_COMPILE_OSX_ARCHITECTURES first to i386 and then to ppc to
+ have the tests run for each specific architecture. Since
+ cmLocalGenerator doesn't allow building for "the other"
+ architecture only via CMAKE_OSX_ARCHITECTURES.
+ */
+ if (const char* tcArchs = this->Makefile->GetDefinition(
+ kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES)) {
+ vars.erase(kCMAKE_OSX_ARCHITECTURES);
+ std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + std::string(tcArchs);
+ cmakeFlags.push_back(flag);
+ }
+
+ for (std::set<std::string>::iterator vi = vars.begin(); vi != vars.end();
+ ++vi) {
+ std::string const& var = *vi;
+ if (const char* val = this->Makefile->GetDefinition(var)) {
+ std::string flag = "-D" + var + "=" + val;
+ cmakeFlags.push_back(flag);
+ }
+ }
}
/* Set the appropriate policy information for ENABLE_EXPORTS */
@@ -461,10 +460,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
cmPolicies::NEW
? "NEW"
: "OLD");
- if (const char* ee =
- this->Makefile->GetDefinition("CMAKE_ENABLE_EXPORTS")) {
- fprintf(fout, "set(CMAKE_ENABLE_EXPORTS %s)\n", ee);
- }
if (targetType == cmState::EXECUTABLE) {
/* Put the executable at a known location (for COPY_FILE). */
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 52278d0..7dece47 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2154,7 +2154,7 @@ std::string::size_type cmSystemToolsFindRPath(std::string const& have,
if (end < have.size() && have[end] != ':') {
pos = beg + 1;
continue;
- }
+ }
// Return the position of the path portion.
return beg;
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index ac2f2fa..11eaa93 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -13,6 +13,8 @@
#include "cmAlgorithms.h"
+#include <cmsys/auto_ptr.hxx>
+
static const char* const cmVariableWatchAccessStrings[] = {
"READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
"MODIFIED_ACCESS", "REMOVED_ACCESS", "NO_ACCESS"
@@ -46,7 +48,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
void* client_data /*=0*/,
DeleteData delete_data /*=0*/)
{
- cmVariableWatch::Pair* p = new cmVariableWatch::Pair;
+ cmsys::auto_ptr<cmVariableWatch::Pair> p(new cmVariableWatch::Pair);
p->Method = method;
p->ClientData = client_data;
p->DeleteDataCall = delete_data;
@@ -60,7 +62,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
return false;
}
}
- vp->push_back(p);
+ vp->push_back(p.release());
return true;
}
diff --git a/Tests/RunCMake/try_compile/PlatformVariables.cmake b/Tests/RunCMake/try_compile/PlatformVariables.cmake
new file mode 100644
index 0000000..54da645
--- /dev/null
+++ b/Tests/RunCMake/try_compile/PlatformVariables.cmake
@@ -0,0 +1,23 @@
+enable_language(C)
+
+# Normally this variable should be set by a platform information module or
+# a toolchain file, but for purposes of this test we simply set it here.
+set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MY_CUSTOM_VARIABLE)
+
+set(MY_CUSTOM_VARIABLE SOME_VALUE)
+
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ OUTPUT_VARIABLE out
+ )
+if(NOT result)
+ message(FATAL_ERROR "try_compile failed:\n${out}")
+endif()
+
+# Check that the cache was populated with our custom variable.
+file(STRINGS ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeCache.txt entries
+ REGEX MY_CUSTOM_VARIABLE:UNINITIALIZED=${MY_CUSTOM_VARIABLE}
+ )
+if(NOT entries)
+ message(FATAL_ERROR "try_compile did not populate cache as expected")
+endif()
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 4b1d92a..ec099fe 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -16,6 +16,10 @@ run_cmake(BadSources2)
run_cmake(NonSourceCopyFile)
run_cmake(NonSourceCompileDefinitions)
+set(RunCMake_TEST_OPTIONS --debug-trycompile)
+run_cmake(PlatformVariables)
+unset(RunCMake_TEST_OPTIONS)
+
run_cmake(TargetTypeExe)
run_cmake(TargetTypeInvalid)
run_cmake(TargetTypeStatic)