Skip to content

Commit

Permalink
Use RESULT.
Browse files Browse the repository at this point in the history
  • Loading branch information
spahrenk committed Nov 8, 2024
1 parent 8a3cbc7 commit 0215847
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
18 changes: 6 additions & 12 deletions cmake/poetry-install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 3 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0215847

Please sign in to comment.