diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2019-01-11 20:29:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-16 15:21:01 (GMT) |
commit | 22b43b0009f37c41b310dd26a4ecb00361975aaa (patch) | |
tree | 409f07a4b849e58793396123deeeb683fb52650b /Tests/RunCMake/VS10Project | |
parent | c59eae7ebc5423c2b06befd762f8639b0f23b7a0 (diff) | |
download | CMake-22b43b0009f37c41b310dd26a4ecb00361975aaa.zip CMake-22b43b0009f37c41b310dd26a4ecb00361975aaa.tar.gz CMake-22b43b0009f37c41b310dd26a4ecb00361975aaa.tar.bz2 |
VS: Add support for VS_DEBUGGER_* properties on custom targets
Visual studio itself supports the corresponding `LocalDebugger*`
properties on utility targets; support generating them from CMake as
well.
Diffstat (limited to 'Tests/RunCMake/VS10Project')
8 files changed, 84 insertions, 72 deletions
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake index 440f9f2..00288d4 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerCommandSet FALSE) + set(debuggerCommandSet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *<LocalDebuggerCommand[^>]*>([^<>]+)</LocalDebuggerCommand>$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo") - message(STATUS "foo.vcxproj has debugger command set") - set(debuggerCommandSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerCommand[^>]*>([^<>]+)</LocalDebuggerCommand>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo") + message(STATUS "${target}.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() 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 index 5dcb6d1..54f9154 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_COMMAND "my-debugger-command $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake index b2e0a43..87555d1 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerCommandArgumentsSet FALSE) + set(debuggerCommandArgumentsSet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *<LocalDebuggerCommandArguments[^>]*>([^<>]+)</LocalDebuggerCommandArguments>$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo") - message(STATUS "foo.vcxproj has debugger command arguments set") - set(debuggerCommandArgumentsSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerCommandArguments[^>]*>([^<>]+)</LocalDebuggerCommandArguments>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo") + message(STATUS "${target}.vcxproj has debugger command arguments set") + set(debuggerCommandArgumentsSet TRUE) + endif() endif() + endforeach() + + if(NOT debuggerCommandArgumentsSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.") + return() endif() endforeach() - -if(NOT debuggerCommandArgumentsSet) - set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake index aa87cdc..1f7d0be 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "my-debugger-command-arguments $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake index 2427ad4..fee121a 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerEnvironmentSet FALSE) + set(debuggerEnvironmentSet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *<LocalDebuggerEnvironment[^>]*>([^<>]+)</LocalDebuggerEnvironment>$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo") - message(STATUS "foo.vcxproj has debugger environment set") - set(debuggerEnvironmentSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerEnvironment[^>]*>([^<>]+)</LocalDebuggerEnvironment>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo") + message(STATUS "${target}.vcxproj has debugger environment set") + set(debuggerEnvironmentSet TRUE) + endif() endif() + endforeach() + + if(NOT debuggerEnvironmentSet) + set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.") + return() endif() endforeach() - -if(NOT debuggerEnvironmentSet) - set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake index d5bec4c..c594f35 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_ENVIRONMENT "my-debugger-environment $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake index 6a142f8..9d3f2a8 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerWorkDirSet FALSE) + 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 foo") - message(STATUS "foo.vcxproj has debugger working dir set") - set(debuggerWorkDirSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerWorkingDirectory[^>]*>([^<>]+)</LocalDebuggerWorkingDirectory>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory foo") + message(STATUS "${target}.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() endforeach() - -if(NOT debuggerWorkDirSet) - set(RunCMake_TEST_FAILED "LocalDebuggerWorkingDirectory not found or not set correctly.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake index 36daed0..69ed85c 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory $<TARGET_PROPERTY:foo,NAME>") |