aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-07-19 14:22:51 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-07-19 15:14:22 -0300
commit794d2608f15155ceba9b6a201fccffbc40d68d45 (patch)
tree15fc2c2a6c01c3a17cf1130e1b07c1ce2dc7a306 /CMakeLists.txt
parentcd479852ad2c9d0f5cdfbba9f91952a8cd3b8688 (diff)
Use correct python library in debug mode.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97d010af8..8a58de664 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,26 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake"
add_custom_target(uninstall "${CMAKE_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+# Detect if the python libs were compiled in debug mode
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; \\
+ print sysconfig.get_config_var('Py_DEBUG')"
+ OUTPUT_VARIABLE PY_DEBUG
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ if(NOT PYTHON_DEBUG_LIBRARIES)
+ message(FATAL_ERROR "Python debug library not found. Try compile shiboken with -DCMAKE_BUILD_TYPE=Release")
+ endif()
+ if(NOT PY_DEBUG)
+ message(WARNING "Compiling shiboken with debug enabled, but the python executable was not compiled with debug support.")
+ endif()
+ add_definitions("-DPy_DEBUG")
+ set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
+else()
+ set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
+endif()
+
if (BUILD_TESTS)
enable_testing()
endif()