diff --git a/scripts/cmake/PreFind.cmake b/scripts/cmake/PreFind.cmake index e49e011034ec3e743bf52558024c2e0f79fbeaa4..252127fc15bb11e7f52cd6685ad252e851f02e0b 100644 --- a/scripts/cmake/PreFind.cmake +++ b/scripts/cmake/PreFind.cmake @@ -95,12 +95,19 @@ if(POETRY) ${PROJECT_BINARY_DIR}/pyproject.toml) endif() if(NOT EXISTS ${PROJECT_BINARY_DIR}/.venv) + if(MSVC) + set(CMD_PREFIX cmd /C) + endif() execute_process( - COMMAND ${POETRY} install + COMMAND ${CMD_PREFIX} ${POETRY} install WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) endif() set(Python3_ROOT_DIR ${PROJECT_BINARY_DIR}/.venv) + set(Python3_EXECUTABLE ${Python3_ROOT_DIR}/bin/python) + if(MSVC) + set(Python3_EXECUTABLE ${Python3_ROOT_DIR}/Scripts/python.exe) + endif() endif() if(OGS_USE_PYTHON) diff --git a/scripts/cmake/test/AddTest.cmake b/scripts/cmake/test/AddTest.cmake index 77ef73a6dbfd5715cd229e329e343d36b8e3bd10..ce12ca9fc8a81b0b355c9061383ea3b76f165470 100644 --- a/scripts/cmake/test/AddTest.cmake +++ b/scripts/cmake/test/AddTest.cmake @@ -298,8 +298,11 @@ Use six arguments version of AddTest with absolute and relative tolerances") ", make sure to have the WRAPPER set to 'poetry'!") endif() if(POETRY) + if(MSVC) + set(CMD_PREFIX cmd /C) + endif() execute_process( - COMMAND poetry add ${AddTest_PYTHON_PACKAGES} + COMMAND ${CMD_PREFIX} poetry add ${AddTest_PYTHON_PACKAGES} WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) else()