diff options
author | Brad King <brad.king@kitware.com> | 2020-02-26 16:38:03 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-02-26 16:38:14 (GMT) |
commit | 85c1b2b6dde8c29187461b3041e26c539ee7ab4e (patch) | |
tree | 699306b0f36358d0176424f29ac6e0578ab071ac /Tests | |
parent | 54d1268ed466c68845e01d28fc17f162f384ac39 (diff) | |
parent | 7c944da75700a2f68879551a253093b73f2d7951 (diff) | |
download | CMake-85c1b2b6dde8c29187461b3041e26c539ee7ab4e.zip CMake-85c1b2b6dde8c29187461b3041e26c539ee7ab4e.tar.gz CMake-85c1b2b6dde8c29187461b3041e26c539ee7ab4e.tar.bz2 |
Merge topic 'vs-sln-deploy'
7c944da757 VS: Add target property to explicitly control solution deployment
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4357
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsDeployEnabled-check.cmake | 58 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsDeployEnabled.cmake | 12 |
3 files changed, 71 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 8a04f78..ff31a74 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -30,6 +30,7 @@ run_cmake(VsDpiAware) run_cmake(VsDpiAwareBadParam) run_cmake(VsPrecompileHeaders) run_cmake(VsPrecompileHeadersReuseFromCompilePDBName) +run_cmake(VsDeployEnabled) run_cmake(VsWinRTByDefault) diff --git a/Tests/RunCMake/VS10Project/VsDeployEnabled-check.cmake b/Tests/RunCMake/VS10Project/VsDeployEnabled-check.cmake new file mode 100644 index 0000000..0ff8678 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDeployEnabled-check.cmake @@ -0,0 +1,58 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() +# +# Test solution file for deployment. +# + +set(vcSlnFile "${RunCMake_TEST_BINARY_DIR}/VsDeployEnabled.sln") +if(NOT EXISTS "${vcSlnFile}") + set(RunCMake_TEST_FAILED "Solution file ${vcSlnFile} does not exist.") + return() +endif() + + + +set(FooProjGUID "") +set(FoundFooProj FALSE) +set(InFooProj FALSE) +set(FoundReleaseDeploy FALSE) +set(DeployConfigs Debug MinSizeRel RelWithDebInfo ) + +file(STRINGS "${vcSlnFile}" lines) +foreach(line IN LISTS lines) +#message(STATUS "${line}") + if( (NOT InFooProj ) AND (line MATCHES "^[ \\t]*Project\\(\"{[A-F0-9-]+}\"\\) = \"foo\", \"foo.vcxproj\", \"({[A-F0-9-]+})\"[ \\t]*$")) + # First, identify the GUID for the foo project, and record it. + set(FoundFooProj TRUE) + set(InFooProj TRUE) + set(FooProjGUID ${CMAKE_MATCH_1}) + elseif(InFooProj AND line MATCHES "EndProject") + set(InFooProj FALSE) + elseif((NOT InFooProj) AND line MATCHES "${FooProjGUID}\\.Release.*\\.Deploy\\.0") + # If foo's Release configuration is set to deploy, this is the error. + set(FoundReleaseDeploy TRUE) + endif() + if( line MATCHES "{[A-F0-9-]+}\\.([^\\|]+).*\\.Deploy\\.0" ) + # Check that the other configurations ARE set to deploy. + list( REMOVE_ITEM DeployConfigs ${CMAKE_MATCH_1}) + endif() +endforeach() + +if(FoundReleaseDeploy) + set(RunCMake_TEST_FAILED "Release deployment enabled.") + return() +endif() + +if(NOT FoundFooProj) + set(RunCMake_TEST_FAILED "Failed to find foo project in the solution.") + return() +endif() + +list(LENGTH DeployConfigs length) +if( length GREATER 0 ) + set(RunCMake_TEST_FAILED "Failed to find Deploy lines for non-Release configurations. (${length})") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDeployEnabled.cmake b/Tests/RunCMake/VS10Project/VsDeployEnabled.cmake new file mode 100644 index 0000000..02b42b2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDeployEnabled.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) + +set(DEPLOY_DIR + "temp\\foodir" +) + +add_library(foo SHARED foo.cpp) + +set_target_properties(foo + PROPERTIES + VS_SOLUTION_DEPLOY $<NOT:$<CONFIG:Release>> +) |