Skip to content

Commit

Permalink
fix: Support venvs on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sindre-nistad committed Jan 17, 2025
1 parent 2914d7f commit 675a60c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmake/python-venv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/venv)
unset(${Python3_EXECUTABLE})
set(VENV_INITIALIZED OFF)
endif ()
set(Python3_EXECUTABLE "${CMAKE_BINARY_DIR}/venv/bin/python")
if (EXISTS "${CMAKE_BINARY_DIR}/venv/bin/python")
set(Python3_EXECUTABLE "${CMAKE_BINARY_DIR}/venv/bin/python")
elseif (EXISTS "${CMAKE_BINARY_DIR}/venv/Scripts/python")
set(Python3_EXECUTABLE "${CMAKE_BINARY_DIR}/venv/Scripts/python")
else ()
message(FATAL_ERROR "Unable to find python in the virtual environment")
endif ()
find_package(Python3 REQUIRED COMPONENTS Interpreter)

if (NOT VENV_INITIALIZED)
Expand Down

0 comments on commit 675a60c

Please sign in to comment.