diff options
-rw-r--r-- | examples/samplebinding/CMakeLists.txt | 22 | ||||
-rw-r--r-- | examples/scriptableapplication/CMakeLists.txt | 16 | ||||
-rw-r--r-- | examples/widgetbinding/CMakeLists.txt | 22 |
3 files changed, 55 insertions, 5 deletions
diff --git a/examples/samplebinding/CMakeLists.txt b/examples/samplebinding/CMakeLists.txt index a57fd67e0..6de44b6ae 100644 --- a/examples/samplebinding/CMakeLists.txt +++ b/examples/samplebinding/CMakeLists.txt @@ -42,7 +42,21 @@ set(generated_sources # ================================== Shiboken detection ====================================== # Use provided python interpreter if given. if(NOT python_interpreter) - find_program(python_interpreter "python") + if(WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + find_program(python_interpreter "python_d") + if(NOT python_interpreter) + message(FATAL_ERROR + "A debug Python interpreter could not be found, which is a requirement when " + "building this example in a debug configuration. Make sure python_d.exe is in " + "PATH.") + endif() + else() + find_program(python_interpreter "python") + if(NOT python_interpreter) + message(FATAL_ERROR + "No Python interpreter could be found. Make sure python is in PATH.") + endif() + endif() endif() message(STATUS "Using python interpreter: ${python_interpreter}") @@ -159,7 +173,11 @@ set_property(TARGET ${bindings_library} PROPERTY PREFIX "") set_property(TARGET ${bindings_library} PROPERTY OUTPUT_NAME "${bindings_library}${PYTHON_EXTENSION_SUFFIX}") if(WIN32) - set_property(TARGET ${bindings_library} PROPERTY SUFFIX ".pyd") + if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set_property(TARGET ${bindings_library} PROPERTY SUFFIX "_d.pyd") + else() + set_property(TARGET ${bindings_library} PROPERTY SUFFIX ".pyd") + endif() endif() # Make sure the linker doesn't complain about not finding Python symbols on macOS. diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt index b1a9ca078..ff1cda25e 100644 --- a/examples/scriptableapplication/CMakeLists.txt +++ b/examples/scriptableapplication/CMakeLists.txt @@ -18,7 +18,21 @@ find_package(Qt6 COMPONENTS Widgets) # Use provided python interpreter if given. if(NOT python_interpreter) - find_program(python_interpreter NAMES python3 python) + if(WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + find_program(python_interpreter "python_d") + if(NOT python_interpreter) + message(FATAL_ERROR + "A debug Python interpreter could not be found, which is a requirement when " + "building this example in a debug configuration. Make sure python_d.exe is in " + "PATH.") + endif() + else() + find_program(python_interpreter "python") + if(NOT python_interpreter) + message(FATAL_ERROR + "No Python interpreter could be found. Make sure python is in PATH.") + endif() + endif() endif() message(STATUS "Using python interpreter: ${python_interpreter}") diff --git a/examples/widgetbinding/CMakeLists.txt b/examples/widgetbinding/CMakeLists.txt index e601a3579..2fe1ddcb0 100644 --- a/examples/widgetbinding/CMakeLists.txt +++ b/examples/widgetbinding/CMakeLists.txt @@ -52,7 +52,21 @@ set(generated_sources # ================================== Shiboken detection ====================================== # Use provided python interpreter if given. if(NOT python_interpreter) - find_program(python_interpreter "python") + if(WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + find_program(python_interpreter "python_d") + if(NOT python_interpreter) + message(FATAL_ERROR + "A debug Python interpreter could not be found, which is a requirement when " + "building this example in a debug configuration. Make sure python_d.exe is in " + "PATH.") + endif() + else() + find_program(python_interpreter "python") + if(NOT python_interpreter) + message(FATAL_ERROR + "No Python interpreter could be found. Make sure python is in PATH.") + endif() + endif() endif() message(STATUS "Using python interpreter: ${python_interpreter}") @@ -204,7 +218,11 @@ set_property(TARGET ${bindings_library} PROPERTY PREFIX "") set_property(TARGET ${bindings_library} PROPERTY OUTPUT_NAME "${bindings_library}${PYTHON_EXTENSION_SUFFIX}") if(WIN32) - set_property(TARGET ${bindings_library} PROPERTY SUFFIX ".pyd") + if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set_property(TARGET ${bindings_library} PROPERTY SUFFIX "_d.pyd") + else() + set_property(TARGET ${bindings_library} PROPERTY SUFFIX ".pyd") + endif() endif() # Make sure the linker doesn't complain about not finding Python symbols on macOS. |