diff options
author | Brad King <brad.king@kitware.com> | 2018-09-28 15:13:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-28 15:13:59 (GMT) |
commit | 4e98203c6c318f7c2caf4c31b2c2863772eef57b (patch) | |
tree | c41a3178a031cc2fa982c32157766149201bcde2 /Tests | |
parent | 8fea6b0764dbf1b6893e7ca81d93cddca2facfce (diff) | |
parent | 36489b85aa308e3a1b984da0d1e7d3aff4467752 (diff) | |
download | CMake-4e98203c6c318f7c2caf4c31b2c2863772eef57b.zip CMake-4e98203c6c318f7c2caf4c31b2c2863772eef57b.tar.gz CMake-4e98203c6c318f7c2caf4c31b2c2863772eef57b.tar.bz2 |
Merge topic 'vs-global-props-for-all-targets'
36489b85aa VS: Add test for CMAKE_VS_GLOBALS
22e670a306 VS: Add option to set VS_GLOBAL_* for all targets
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2345
Diffstat (limited to 'Tests')
-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) |