diff --git a/CMakeLists.txt b/CMakeLists.txt index 0536f1fc..ac052bed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,12 @@ else() set(DESKTOP OFF) endif() +# Define the Python executable before including the subprojects +find_program(FIREBASE_PYTHON_EXECUTABLE + NAMES python3 python + REQUIRED +) + include(FindPkgConfig) include(android_dependencies) include(build_universal) diff --git a/cmake/build_aar.cmake b/cmake/build_aar.cmake index 6f06ca98..2cf20853 100644 --- a/cmake/build_aar.cmake +++ b/cmake/build_aar.cmake @@ -45,7 +45,7 @@ function(build_aar LIBRARY_NAME LIBRARY_TARGET PROGUARD_TARGET add_custom_command( OUTPUT "${OUTPUT_AAR}" - COMMAND python "${FIREBASE_SOURCE_DIR}/aar_builder/build_aar.py" + COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${FIREBASE_SOURCE_DIR}/aar_builder/build_aar.py" "--output_file=${OUTPUT_AAR}" "--library_file=$" "--architecture=${ANDROID_ABI}" diff --git a/cmake/firebase_swig.cmake b/cmake/firebase_swig.cmake index 3556bfaf..db69bc9e 100644 --- a/cmake/firebase_swig.cmake +++ b/cmake/firebase_swig.cmake @@ -202,13 +202,13 @@ macro(firebase_swig_add_library name) OUTPUT ${UNITY_SWIG_CS_FIX_FILE} DEPENDS ${UNITY_SWIG_CS_GEN_FILE} COMMAND - python + ${FIREBASE_PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/../swig_commenter.py --input=\"${all_cpp_header_files}\" --output=\"${UNITY_SWIG_CS_GEN_FILE}\" --namespace_prefix=\"Firebase\" COMMAND - python + ${FIREBASE_PYTHON_EXECUTABLE} ${FIREBASE_SWIG_FIX_PY} --language=csharp --in_file=\"${UNITY_SWIG_CS_GEN_FILE}\" @@ -233,7 +233,7 @@ macro(firebase_swig_add_library name) OUTPUT ${UNITY_SWIG_CPP_FIX_FILE} DEPENDS ${UNITY_SWIG_CPP_GEN_FILE} COMMAND - python + ${FIREBASE_PYTHON_EXECUTABLE} ${FIREBASE_SWIG_FIX_PY} --language=cpp --in_file=\"${UNITY_SWIG_CPP_GEN_FILE}\"