examples: Suffix package exe with .exe on Windows

Without this the vscode extension cannot find the example executable, and the example fails.

Also use $USERPROFILE instead of  $HOME for finding the `.vscode` user directory for installing the extension.

Bug: #12
This commit is contained in:
Ben Clayton 2020-01-17 18:59:05 +00:00 committed by Ben Clayton
parent cdc19ac4d9
commit 93b861004e
2 changed files with 9 additions and 2 deletions

View File

@ -85,10 +85,13 @@ set(CPPDAP_LIST
###########################################################
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CPPDAP_OS_LIBS WS2_32)
set(CPPDAP_OS_EXE_EXT ".exe")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPPDAP_OS_LIBS pthread)
set(CPPDAP_OS_EXE_EXT "")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPPDAP_OS_LIBS)
set(CPPDAP_OS_EXE_EXT "")
endif()
###########################################################
@ -230,7 +233,11 @@ if(CPPDAP_BUILD_EXAMPLES)
target_link_libraries(${target} cppdap "${CPPDAP_OS_LIBS}")
if(CPPDAP_INSTALL_VSCODE_EXAMPLES)
set(extroot "$ENV{HOME}/.vscode/extensions")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(extroot "$ENV{USERPROFILE}\\.vscode\\extensions")
else()
set(extroot "$ENV{HOME}/.vscode/extensions")
endif()
if(EXISTS ${extroot})
set(extdir "${extroot}/google.cppdap-example-${target}-1.0.0")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/examples/vscode/package.json ${extdir}/package.json)

View File

@ -19,7 +19,7 @@
"debuggers": [
{
"type": "@target@",
"program": "@target@",
"program": "@target@@CPPDAP_OS_EXE_EXT@",
"label": "cppdap example: @target@",
"configurationAttributes": {}
}