From 5a7113d8fb2a6f1290b4533ff46e88a55fc2c656 Mon Sep 17 00:00:00 2001 From: Hannes Mezger Date: Mon, 12 Mar 2018 16:19:08 +0100 Subject: VS: Add target property VS_DEBUGGER_COMMAND Fixes: #17819 --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_tgt/VS_DEBUGGER_COMMAND.rst | 9 +++++++++ Help/release/dev/vs-debugger-config.rst | 6 ++++++ Source/cmVisualStudio10TargetGenerator.cxx | 7 +++++++ Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/VsDebuggerCommand-check.cmake | 22 ++++++++++++++++++++++ Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake | 5 +++++ 7 files changed, 51 insertions(+) create mode 100644 Help/prop_tgt/VS_DEBUGGER_COMMAND.rst create mode 100644 Help/release/dev/vs-debugger-config.rst create mode 100644 Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake create mode 100644 Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 9d4a7e8..86ca2e4 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -296,6 +296,7 @@ Properties on Targets /prop_tgt/VISIBILITY_INLINES_HIDDEN /prop_tgt/VS_CONFIGURATION_TYPE /prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY + /prop_tgt/VS_DEBUGGER_COMMAND /prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION /prop_tgt/VS_DOTNET_REFERENCE_refname /prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst new file mode 100644 index 0000000..f898750 --- /dev/null +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst @@ -0,0 +1,9 @@ +VS_DEBUGGER_COMMAND +------------------- + +Sets the local debugger command for Visual Studio C++ targets. +This is defined in ```` in the Visual Studio +project file. + +This property only works for Visual Studio 2010 and above; +it is ignored on other generators. diff --git a/Help/release/dev/vs-debugger-config.rst b/Help/release/dev/vs-debugger-config.rst new file mode 100644 index 0000000..bddae0c --- /dev/null +++ b/Help/release/dev/vs-debugger-config.rst @@ -0,0 +1,6 @@ +vs-debugger-configuration +------------------------- + +* For the :ref:`Visual Studio Generators` for VS 2010 and above + the debugging command line can be set using a new + :prop_tgt:`VS_DEBUGGER_COMMAND` target property. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0fd8043..d6e0388 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2180,6 +2180,13 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() << "\n"; } + if (const char* debuggerCommand = + this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { + this->WritePlatformConfigTag("LocalDebuggerCommand", config, 2); + *this->BuildFileStream << cmVS10EscapeXML(debuggerCommand) + << "\n"; + } + std::string name = cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); this->WritePlatformConfigTag("TargetName", config, 2); diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 7100b31..afe9d6d 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -3,6 +3,7 @@ run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) +run_cmake(VsDebuggerCommand) run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake new file mode 100644 index 0000000..0ded780 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake @@ -0,0 +1,22 @@ +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(debuggerCommandSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *]*>([^<>]+)$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command") + message(STATUS "foo.vcxproj has debugger command set") + set(debuggerCommandSet TRUE) + endif() + endif() +endforeach() + +if(NOT debuggerCommandSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommand not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake new file mode 100644 index 0000000..e29adc4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + VS_DEBUGGER_COMMAND "my-debugger-command") -- cgit v0.12