summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VSSolution
diff options
context:
space:
mode:
authorMichael Stürmer <michael.stuermer@schaeffler.com>2016-11-21 12:25:35 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-29 13:46:27 (GMT)
commit9e3164dfa2747bd15c3d3e780875a9b286b765c6 (patch)
tree2b567572d36559c839609185ae7c059bb452d005 /Tests/RunCMake/VSSolution
parent1528831bb1330cc539004f9fb3068e871f109d34 (diff)
downloadCMake-9e3164dfa2747bd15c3d3e780875a9b286b765c6.zip
CMake-9e3164dfa2747bd15c3d3e780875a9b286b765c6.tar.gz
CMake-9e3164dfa2747bd15c3d3e780875a9b286b765c6.tar.bz2
VS: Add option to place `PACKAGE` target in solution default build
Add a `CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD` variable to control this behavior.
Diffstat (limited to 'Tests/RunCMake/VSSolution')
-rw-r--r--Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake29
-rw-r--r--Tests/RunCMake/VSSolution/AddPackageToDefault.cmake2
-rw-r--r--Tests/RunCMake/VSSolution/RunCMakeTest.cmake1
3 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake b/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake
new file mode 100644
index 0000000..7265900
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake
@@ -0,0 +1,29 @@
+set(vcSlnFile "${RunCMake_TEST_BINARY_DIR}/AddPackageToDefault.sln")
+if(NOT EXISTS "${vcSlnFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcSlnFile} does not exist.")
+ return()
+endif()
+
+set(packageGuidFound FALSE)
+set(packageGuid "")
+set(packageInBuild FALSE)
+file(STRINGS "${vcSlnFile}" lines)
+foreach(line IN LISTS lines)
+ if(NOT packageGuidFound)
+ if(line MATCHES "^Project.*\"PACKAGE.vcx?proj\".*\"{([A-F0-9-]+)}\"$")
+ set(packageGuidFound TRUE)
+ set(packageGuid ${CMAKE_MATCH_1})
+ endif()
+ else()
+ if(line MATCHES ".*{${packageGuid}}.*")
+ if(line MATCHES "^[ \t]*{${packageGuid}}\\..*\\.Build.0 = .*$")
+ set(packageInBuild TRUE)
+ endif()
+ endif()
+ endif()
+endforeach()
+
+if(NOT packageInBuild)
+ set(RunCMake_TEST_FAILED "PACKAGE is not in default build")
+ return()
+endif()
diff --git a/Tests/RunCMake/VSSolution/AddPackageToDefault.cmake b/Tests/RunCMake/VSSolution/AddPackageToDefault.cmake
new file mode 100644
index 0000000..5f69ec5
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/AddPackageToDefault.cmake
@@ -0,0 +1,2 @@
+include(CPack)
+set(CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD TRUE)
diff --git a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
index afd74a1..4ec3e3b 100644
--- a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
@@ -10,6 +10,7 @@ run_cmake(Override1)
run_cmake(Override2)
run_cmake(StartupProject)
run_cmake(StartupProjectMissing)
+run_cmake(AddPackageToDefault)
if(RunCMake_GENERATOR MATCHES "Visual Studio ([^7]|[7][0-9])" AND NOT NO_USE_FOLDERS)
run_cmake(StartupProjectUseFolders)