summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx7
-rw-r--r--Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/cmake_host_system_information/VsMSBuild.cmake4
-rw-r--r--Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-result.txt1
-rw-r--r--Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing.cmake1
6 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 74071ff..3922c56 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -27,6 +27,7 @@
#ifdef _WIN32
# include "cmAlgorithms.h"
# include "cmGlobalGenerator.h"
+# include "cmGlobalVisualStudio10Generator.h"
# include "cmGlobalVisualStudioVersionedGenerator.h"
# include "cmVSSetupHelper.h"
# define HAVE_VS_SETUP_HELPER
@@ -434,6 +435,12 @@ cm::optional<std::string> GetValue(cmExecutionStatus& status,
}
}
+ if (key == "VS_MSBUILD_COMMAND"_s && gg->IsVisualStudioAtLeast10()) {
+ cmGlobalVisualStudio10Generator* vs10gen =
+ static_cast<cmGlobalVisualStudio10Generator*>(gg);
+ return vs10gen->FindMSBuildCommandEarly(&status.GetMakefile());
+ }
+
return {};
}
#endif
diff --git a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
index 189013f..87b6944 100644
--- a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
@@ -15,3 +15,9 @@ run_cmake(CentOS6)
run_cmake(Debian6)
run_cmake(UserFallbackScript)
+
+if(RunCMake_GENERATOR MATCHES "^Visual Studio " AND NOT RunCMake_GENERATOR STREQUAL "Visual Studio 9 2008")
+ run_cmake(VsMSBuild)
+else()
+ run_cmake(VsMSBuildMissing)
+endif()
diff --git a/Tests/RunCMake/cmake_host_system_information/VsMSBuild.cmake b/Tests/RunCMake/cmake_host_system_information/VsMSBuild.cmake
new file mode 100644
index 0000000..30e616e
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/VsMSBuild.cmake
@@ -0,0 +1,4 @@
+cmake_host_system_information(RESULT msbuild QUERY VS_MSBUILD_COMMAND)
+if(NOT EXISTS "${msbuild}")
+ message(FATAL_ERROR "VS_MSBUILD_COMMAND returned path that does not exist:\n ${msbuild}")
+endif()
diff --git a/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-result.txt b/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-stderr.txt b/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-stderr.txt
new file mode 100644
index 0000000..3a7dfef
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at VsMSBuildMissing.cmake:[0-9]+ \(cmake_host_system_information\):
+ cmake_host_system_information does not recognize <key> VS_MSBUILD_COMMAND
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing.cmake b/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing.cmake
new file mode 100644
index 0000000..23c0364
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/VsMSBuildMissing.cmake
@@ -0,0 +1 @@
+cmake_host_system_information(RESULT msbuild QUERY VS_MSBUILD_COMMAND)