Commit 163e8018 authored by Michael Stürmer's avatar Michael Stürmer Committed by Brad King
Browse files

VS: Add target property VS_DEBUGGER_WORKING_DIRECTORY

parent afe7d5f2
Pipeline #36644 passed with stage
......@@ -269,6 +269,7 @@ Properties on Targets
/prop_tgt/VERSION
/prop_tgt/VISIBILITY_INLINES_HIDDEN
/prop_tgt/VS_CONFIGURATION_TYPE
/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY
/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION
/prop_tgt/VS_DOTNET_REFERENCES
/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION
......
VS_DEBUGGER_WORKING_DIRECTORY
-----------------------------
Sets the local debugger working directory for Visual Studio C++ targets.
This is defined in ``<LocalDebuggerWorkingDirectory>`` in the Visual Studio
project file.
vs-debugger-configuration
-------------------------
* For the :ref:`Visual Studio Generators` for VS 2010 and above
the working directory for debugging can be set using a new
:prop_tgt:`VS_DEBUGGER_WORKING_DIRECTORY` target property.
......@@ -1569,6 +1569,14 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
*this->BuildFileStream << cmVS10EscapeXML(intermediateDir)
<< "</IntDir>\n";
if (const char* workingDir = this->GeneratorTarget->GetProperty(
"VS_DEBUGGER_WORKING_DIRECTORY")) {
this->WritePlatformConfigTag("LocalDebuggerWorkingDirectory",
config->c_str(), 3);
*this->BuildFileStream << cmVS10EscapeXML(workingDir)
<< "</LocalDebuggerWorkingDirectory>\n";
}
std::string name =
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
this->WritePlatformConfigTag("TargetName", config->c_str(), 3);
......
......@@ -2,3 +2,4 @@ include(RunCMake)
run_cmake(VsConfigurationType)
run_cmake(VsTargetsFileReferences)
run_cmake(VsCustomProps)
run_cmake(VsDebuggerWorkingDir)
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(debuggerWorkDirSet FALSE)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "^ *<LocalDebuggerWorkingDirectory[^>]*>([^<>]+)</LocalDebuggerWorkingDirectory>$")
if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory")
message(STATUS "foo.vcxproj has debugger working dir set")
set(debuggerWorkDirSet TRUE)
endif()
endif()
endforeach()
if(NOT debuggerWorkDirSet)
set(RunCMake_TEST_FAILED "LocalDebuggerWorkingDirectory not found or not set correctly.")
return()
endif()
enable_language(CXX)
add_library(foo foo.cpp)
set_target_properties(foo PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment