diff options
author | Mikhail Korolev <stilriv@gmail.com> | 2018-09-27 12:17:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-28 15:13:03 (GMT) |
commit | 36489b85aa308e3a1b984da0d1e7d3aff4467752 (patch) | |
tree | 3bf09982f92b30f8e3c4764c114231b4a4a496a6 /Tests/RunCMake/VS10Project | |
parent | 22e670a3062869e3014455563d800c72f35d9e4f (diff) | |
download | CMake-36489b85aa308e3a1b984da0d1e7d3aff4467752.zip CMake-36489b85aa308e3a1b984da0d1e7d3aff4467752.tar.gz CMake-36489b85aa308e3a1b984da0d1e7d3aff4467752.tar.bz2 |
VS: Add test for CMAKE_VS_GLOBALS
Diffstat (limited to 'Tests/RunCMake/VS10Project')
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsGlobals-check.cmake | 44 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsGlobals.cmake | 8 |
3 files changed, 53 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index d50de3d..4bfb2f2 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -13,3 +13,4 @@ run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) run_cmake(VsSdkDirectories) +run_cmake(VsGlobals) diff --git a/Tests/RunCMake/VS10Project/VsGlobals-check.cmake b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake new file mode 100644 index 0000000..0e7fd45 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake @@ -0,0 +1,44 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(InsideGlobals FALSE) +set(DefaultLanguageSet FALSE) +set(MinimumVisualStudioVersionSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$") + set(InsideGlobals TRUE) + elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> *$") + if("${CMAKE_MATCH_1}" STREQUAL "en-US") + if(InsideGlobals) + message(STATUS "foo.vcxproj has correct DefaultLanguage global property") + set(DefaultLanguageSet TRUE) + else() + message(STATUS "DefaultLanguage is set but not within \"Globals\" property group") + endif() + endif() + elseif(line MATCHES "^ *<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$") + if("${CMAKE_MATCH_1}" STREQUAL "14.0") + if(InsideGlobals) + message(STATUS "foo.vcxproj has correct MinimumVisualStudioVersion global property") + set(MinimumVisualStudioVersionSet TRUE) + else() + message(STATUS "MinimumVisualStudioVersion is set but not within \"Globals\" property group") + endif() + endif() + endif() +endforeach() + +if(NOT DefaultLanguageSet) + set(RunCMake_TEST_FAILED "DefaultLanguageSet not found or not set correctly.") + return() +endif() + +if(NOT MinimumVisualStudioVersionSet) + set(RunCMake_TEST_FAILED "MinimumVisualStudioVersionSet not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsGlobals.cmake b/Tests/RunCMake/VS10Project/VsGlobals.cmake new file mode 100644 index 0000000..a3ed5af --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsGlobals.cmake @@ -0,0 +1,8 @@ +enable_language(CXX) + +set(CMAKE_VS_GLOBALS + "DefaultLanguage=en-US" + "MinimumVisualStudioVersion=14.0" +) + +add_library(foo foo.cpp) |