Commit 93b86100 by Ben Clayton Committed by Ben Clayton

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
parent cdc19ac4
...@@ -85,10 +85,13 @@ set(CPPDAP_LIST ...@@ -85,10 +85,13 @@ set(CPPDAP_LIST
########################################################### ###########################################################
if(CMAKE_SYSTEM_NAME MATCHES "Windows") if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CPPDAP_OS_LIBS WS2_32) set(CPPDAP_OS_LIBS WS2_32)
set(CPPDAP_OS_EXE_EXT ".exe")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPPDAP_OS_LIBS pthread) set(CPPDAP_OS_LIBS pthread)
set(CPPDAP_OS_EXE_EXT "")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPPDAP_OS_LIBS) set(CPPDAP_OS_LIBS)
set(CPPDAP_OS_EXE_EXT "")
endif() endif()
########################################################### ###########################################################
...@@ -230,7 +233,11 @@ if(CPPDAP_BUILD_EXAMPLES) ...@@ -230,7 +233,11 @@ if(CPPDAP_BUILD_EXAMPLES)
target_link_libraries(${target} cppdap "${CPPDAP_OS_LIBS}") target_link_libraries(${target} cppdap "${CPPDAP_OS_LIBS}")
if(CPPDAP_INSTALL_VSCODE_EXAMPLES) 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}) if(EXISTS ${extroot})
set(extdir "${extroot}/google.cppdap-example-${target}-1.0.0") set(extdir "${extroot}/google.cppdap-example-${target}-1.0.0")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/examples/vscode/package.json ${extdir}/package.json) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/examples/vscode/package.json ${extdir}/package.json)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"debuggers": [ "debuggers": [
{ {
"type": "@target@", "type": "@target@",
"program": "@target@", "program": "@target@@CPPDAP_OS_EXE_EXT@",
"label": "cppdap example: @target@", "label": "cppdap example: @target@",
"configurationAttributes": {} "configurationAttributes": {}
} }
......
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