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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac15424..79ff71f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -85,10 +85,13 @@
###########################################################
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 @@
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)
diff --git a/examples/vscode/package.json b/examples/vscode/package.json
index bd9e378..9a52413 100644
--- a/examples/vscode/package.json
+++ b/examples/vscode/package.json
@@ -19,7 +19,7 @@
"debuggers": [
{
"type": "@target@",
- "program": "@target@",
+ "program": "@target@@CPPDAP_OS_EXE_EXT@",
"label": "cppdap example: @target@",
"configurationAttributes": {}
}