Skip to content

Commit

Permalink
temp vswhere
Browse files Browse the repository at this point in the history
  • Loading branch information
meastp committed Jan 5, 2024
1 parent 6ef4d56 commit dadb290
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions ext/src/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,33 @@ if(WITH_OTLP_HTTP)
PRIVATE opentelemetry_exporter_otlp_http_log)
endif()

find_program(_vswhere_tool
NAMES vswhere
PATHS "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/Installer")
if (NOT ${vswhere})
message(FATAL_ERROR "Could not locate vswhere.exe - unable to locate dumpbin.exe")
endif()

execute_process(
COMMAND "${_vswhere_tool}" -latest -find **/dumpbin.exe
OUTPUT_VARIABLE DUMPBIN_PATHS
RESULT_VARIABLE _vs_where_exitcode
OUTPUT_STRIP_TRAILING_WHITESPACE
)

message(STATUS "DUMPBIN PATHS: ${DUMPBIN_PATHS} ${RESULT_VARIABLE}")

string(REPLACE "\n" ";" DUMPBIN_PATHS_LIST ${DUMPBIN_PATHS})

list(POP_FRONT DUMPBIN_PATHS_LIST DUMPBIN_PATH)

message(STATUS "DUMPBIN PATH: ${DUMPBIN_PATH}")

# find Powershell executable
find_program(DUMPBIN_PATH NAMES dumpbin)
#find_program(DUMPBIN_PATH NAMES dumpbin REQUIRED)

# find Powershell executable
find_program(POWERSHELL_PATH NAMES pwsh powershell)
find_program(POWERSHELL_PATH NAMES pwsh powershell REQUIRED)

set(OPENTELEMETRY_INPUT_DEF
"${CMAKE_CURRENT_SOURCE_DIR}/input.txt")
Expand All @@ -80,7 +101,7 @@ add_custom_command(
"-File"
"${CMAKE_CURRENT_SOURCE_DIR}/make_def.ps1"
"-dumpbin"
${DUMPBIN_PATH}
"${DUMPBIN_PATH}"
"-bindir"
${PROJECT_BINARY_DIR}
"-inputfile"
Expand Down

0 comments on commit dadb290

Please sign in to comment.