mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
VS: Honor VS_SOLUTION_DEPLOY on targets created by add_custom_target
Fixes: #27772
This commit is contained in:
committed by
Brad King
parent
1279bda9ef
commit
6c0b499dab
@@ -11,6 +11,10 @@ any effect.
|
||||
|
||||
:manual:`Generator expressions <cmake-generator-expressions(7)>` are supported.
|
||||
|
||||
.. versionadded:: 4.4
|
||||
|
||||
Targets created by :command:`add_custom_target` now honor this property.
|
||||
|
||||
Examples
|
||||
^^^^^^^^
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
vs-deploy-utility-fix
|
||||
---------------------
|
||||
|
||||
* The :prop_tgt:`VS_SOLUTION_DEPLOY` target property is now implemented
|
||||
for targets created by :command:`add_custom_target`.
|
||||
@@ -360,8 +360,8 @@ bool cmGlobalVisualStudio8Generator::NeedsDeploy(
|
||||
{
|
||||
cmStateEnums::TargetType const type = target.GetType();
|
||||
if (type != cmStateEnums::EXECUTABLE &&
|
||||
type != cmStateEnums::SHARED_LIBRARY) {
|
||||
// deployment only valid on executables and shared libraries.
|
||||
type != cmStateEnums::SHARED_LIBRARY && type != cmStateEnums::UTILITY) {
|
||||
// deployment only valid on executables, shared libraries, and utilities.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@ if(NOT EXISTS "${vcSlnFile}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(STRINGS "${vcSlnFile}" lines)
|
||||
|
||||
|
||||
# Foo
|
||||
set(FooProjGUID "")
|
||||
set(FoundFooProj FALSE)
|
||||
set(InFooProj FALSE)
|
||||
set(FoundReleaseDeploy FALSE)
|
||||
set(DeployConfigs Debug MinSizeRel RelWithDebInfo )
|
||||
set(FooDeployConfigs 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]*$"))
|
||||
@@ -32,7 +32,7 @@ foreach(line IN LISTS lines)
|
||||
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})
|
||||
list( REMOVE_ITEM FooDeployConfigs ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -42,12 +42,45 @@ if(FoundReleaseDeploy)
|
||||
endif()
|
||||
|
||||
if(NOT FoundFooProj)
|
||||
set(RunCMake_TEST_FAILED "Failed to find foo project in the solution.")
|
||||
set(RunCMake_TEST_FAILED "Failed to find 'foo' project in the solution.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
list(LENGTH DeployConfigs length)
|
||||
list(LENGTH FooDeployConfigs length)
|
||||
if( length GREATER 0 )
|
||||
set(RunCMake_TEST_FAILED "Failed to find Deploy lines for non-Release configurations. (${length})")
|
||||
set(RunCMake_TEST_FAILED "Failed to find 'foo' Deploy lines for non-Release configurations. (${length})")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Utility
|
||||
set(UtilityProjGUID "")
|
||||
set(InUtilityProj FALSE)
|
||||
set(FoundUtilityProj FALSE)
|
||||
set(UtilityDeployConfigs Debug MinSizeRel RelWithDebInfo Release)
|
||||
|
||||
foreach(line IN LISTS lines)
|
||||
if( (NOT InUtilityProj) AND (line MATCHES "^[ \\t]*Project\\(\"{[A-F0-9-]+}\"\\) = \"utility\", \"utility.vcxproj\", \"({[A-F0-9-]+})\"[ \\t]*$"))
|
||||
# First, identify the GUID for the utility project, and record it.
|
||||
set(FoundUtilityProj TRUE)
|
||||
set(InUtilityProj TRUE)
|
||||
set(UtilityProjGUID ${CMAKE_MATCH_1})
|
||||
elseif(InUtilityProj AND line MATCHES "EndProject")
|
||||
set(InUtilityProj FALSE)
|
||||
endif()
|
||||
|
||||
if( line MATCHES "{[A-F0-9-]+}\\.([^\\|]+).*\\.Deploy\\.0" )
|
||||
# Check that the other configurations ARE set to deploy.
|
||||
list( REMOVE_ITEM UtilityDeployConfigs ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT FoundUtilityProj)
|
||||
set(RunCMake_TEST_FAILED "Failed to find 'utility' project in the solution.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
list(LENGTH UtilityDeployConfigs length)
|
||||
if( length GREATER 0 )
|
||||
set(RunCMake_TEST_FAILED "Failed to find 'utility' Deploy lines for all configurations. (${length})")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -23,4 +23,15 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/DeployEnabled.slnx" [[
|
||||
<Deploy Solution="MinSizeRel\|\*"/>
|
||||
<Deploy Solution="RelWithDebInfo\|\*"/>
|
||||
</Project>
|
||||
<Project Path="utility\.vcxproj" Type="8bc9ceb8-8b4a-11d0-8d11-00a0c91bc942" Id="[0-9a-f-]+">
|
||||
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
|
||||
<Build Solution="Debug\|\*" Project="false"/>
|
||||
<Deploy Solution="Debug\|\*"/>
|
||||
<Build Solution="Release\|\*" Project="false"/>
|
||||
<Deploy Solution="Release\|\*"/>
|
||||
<Build Solution="MinSizeRel\|\*" Project="false"/>
|
||||
<Deploy Solution="MinSizeRel\|\*"/>
|
||||
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
|
||||
<Deploy Solution="RelWithDebInfo\|\*"/>
|
||||
</Project>
|
||||
</Solution>$]])
|
||||
|
||||
@@ -10,3 +10,10 @@ set_target_properties(foo
|
||||
PROPERTIES
|
||||
VS_SOLUTION_DEPLOY $<NOT:$<CONFIG:Release>>
|
||||
)
|
||||
|
||||
add_custom_target(utility)
|
||||
|
||||
set_target_properties(utility
|
||||
PROPERTIES
|
||||
VS_SOLUTION_DEPLOY TRUE
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user