diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-09-21 13:45:46 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:07:18 -0300 |
commit | 24d496c1d05baae8f129d76207709276391faebf (patch) | |
tree | 2a72f5a6ecbc15d6cd89aff385927b407c309b93 | |
parent | f2bd66ead497ba2c17f2124ed7e1487251aca6d0 (diff) |
Move Python debug check to root Cmake file.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 21 |
2 files changed, 23 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2830bcba9..8c831763a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,29 @@ 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.") + else() + add_definitions("-DPy_DEBUG") + endif() + set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES}) +else() + set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES}) + add_definitions("-DNDEBUG") +endif() + + if (BUILD_TESTS) enable_testing() endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 48d9de484..e33305dff 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,27 +1,6 @@ add_subdirectory(libsample) add_subdirectory(libother) -# 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.") - else() - add_definitions("-DPy_DEBUG") - endif() - set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES}) -else() - set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES}) - add_definitions("-DNDEBUG") -endif() add_subdirectory(samplebinding) add_subdirectory(otherbinding) |