diff --git a/cmake/poetry-install.cmake b/cmake/poetry-install.cmake index 4120b831..25e43c56 100644 --- a/cmake/poetry-install.cmake +++ b/cmake/poetry-install.cmake @@ -2,17 +2,11 @@ macro(poetry_install pythonScriptDir) - # execute 'poetry install' - #set(pythonScriptDir "${PROJECT_SOURCE_DIR}/scripts/python") - if (NOT ${PROJECT_NAME}_PYTHON_SETUP) - execute_process( - COMMAND poetry install - WORKING_DIRECTORY "${pythonScriptDir}" - RESULT_VARIABLE result0 - ERROR_VARIABLE errors0 - OUTPUT_VARIABLE outputs0) - - set(${PROJECT_NAME}_PYTHON_SETUP TRUE CACHE BOOL "Python environment is already setup" FORCE) - endif () + execute_process( + COMMAND poetry install + WORKING_DIRECTORY "${pythonScriptDir}" + RESULT_VARIABLE result + ERROR_VARIABLE errors + OUTPUT_VARIABLE outputs) endmacro() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 93151f96..218412ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,19 +24,18 @@ if (NOT ${PROJECT_NAME}_DATA_MODEL_GENERATED) COMMAND ${GIT_EXECUTABLE} submodule update --init "${dataModelDir}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT COMMAND poetry run python "build_data_model.py" "${PROJECT_SOURCE_DIR}" "${dataModelDir}" "${genCodeDir}" WORKING_DIRECTORY "${pythonScriptDir}" - ERROR_VARIABLE build_data_model_err) + RESULT_VARIABLE build_data_model_result) - if(NOT build_data_model_err) + if (build_data_model_result EQUAL 0) set(${PROJECT_NAME}_DATA_MODEL_GENERATED TRUE CACHE BOOL "Python data-model source code has been generated" FORCE) message(STATUS "Data-model source-code generation succeeded") else() message(STATUS "Data-model source-code generation failed") endif() -else() - message(STATUS "Using existing data-model source code") endif() set(headers