summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-17 22:21:30 (GMT)
committerBrad King <brad.king@kitware.com>2011-01-17 22:21:30 (GMT)
commit56efc60fa0b9ef067d4b5648e43136b250872088 (patch)
tree4f91dfb38c31d545127484ec90d6591ddcf344d4 /Source
parent28a0403c3491d4a96f5dc827e54442a1d0a0dea7 (diff)
downloadCMake-56efc60fa0b9ef067d4b5648e43136b250872088.zip
CMake-56efc60fa0b9ef067d4b5648e43136b250872088.tar.gz
CMake-56efc60fa0b9ef067d4b5648e43136b250872088.tar.bz2
Honor CMAKE_TRY_COMPILE_CONFIGURATION in Makefile generators (#10809)
Previously this was used only in multi-configuration generators to choose the configuration of try_compile and try_run at their build time. Teach CMake to honor the variable in single-configuration generators as the CMAKE_BUILD_TYPE.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 53f4c3c..43a7ae0 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2717,6 +2717,18 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
cm.SetStartOutputDirectory(bindir);
cm.SetCMakeCommand(cmakeCommand.c_str());
cm.LoadCache();
+ if(!gg->IsMultiConfig())
+ {
+ if(const char* config =
+ this->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"))
+ {
+ // Tell the single-configuration generator which one to use.
+ // Add this before the user-provided CMake arguments in case
+ // one of the arguments is -DCMAKE_BUILD_TYPE=...
+ cm.AddCacheEntry("CMAKE_BUILD_TYPE", config,
+ "Build configuration", cmCacheManager::STRING);
+ }
+ }
// if cmake args were provided then pass them in
if (cmakeArgs)
{