1

I have some Python scripts which should run when building the Flutter Windows app. It looks like:

find_package( PythonInterp 3 REQUIRED )
add_custom_target(
 myscript ALL
 COMMAND ${PYTHON_EXECUTABLE} somefile.py
)
add_dependencies(${PLUGIN_NAME} myscript)

However, in my script, I need to know whether it is doing a debug or a release build. But I cannot find out an approach to do this.

I have tried to print every cmake variable, and nothing indicates it is a debug or release. I have also tried to print out all environment variables in the python script, but again nothing interesting.

Thanks for any suggestions!

ch271828n
  • 15,854
  • 5
  • 53
  • 88

1 Answers1

0

In https://github.com/flutter/flutter/issues/99595, @stuartmorgan provides a good answer, so I paste it here in case someone needs it:

There is nothing special about the CMake builds used in the Flutter template; determining the build type is done in the usual way.

And that "usual way" is https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#build-configurations :

# Works correctly for both single and multi-config generators
target_compile_definitions(exe1 PRIVATE
  $<$<CONFIG:Debug>:DEBUG_BUILD>
)
ch271828n
  • 15,854
  • 5
  • 53
  • 88