From e5042dc193bbcb4b1566594d832076adfef5fd94 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Wed, 21 Jul 2010 17:10:48 -0300 Subject: Added a custom cmake file to help finding Python debug provisions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed by Luciano Wolf Reviewed by Renato Araújo --- CMakeLists.txt | 5 ++++- cmake/Modules/FindPythonInterpWithDebug.cmake | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/FindPythonInterpWithDebug.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 61a6116eb..d601f840b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,9 @@ project(pysidebindings) cmake_minimum_required(VERSION 2.6) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules/ + ${CMAKE_MODULE_PATH}) + if(CMAKE_HOST_UNIX) option(ENABLE_GCC_OPTIMIZATION "Enable specific GCC flags to optimization library size and performance. Only available on Release Mode" 0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fvisibility=hidden -Wno-strict-aliasing") @@ -34,7 +37,7 @@ if(AVOID_PROTECTED_HACK OR WIN32) endif() find_package(PythonLibs REQUIRED) -find_package(PythonInterp REQUIRED) +find_package(PythonInterpWithDebug REQUIRED) find_package(Shiboken 0.3.3 REQUIRED) find_package(Qt4 4.5.0 REQUIRED) diff --git a/cmake/Modules/FindPythonInterpWithDebug.cmake b/cmake/Modules/FindPythonInterpWithDebug.cmake new file mode 100644 index 000000000..264dd5d81 --- /dev/null +++ b/cmake/Modules/FindPythonInterpWithDebug.cmake @@ -0,0 +1,21 @@ +INCLUDE(FindPythonInterp) + +find_package(PythonInterp REQUIRED) + +#Fix missing variable on UNIX env +if(NOT PYTHON_DEBUG_LIBRARIES AND UNIX) + set(PYTHON_DEBUG_LIBRARIES "${PYTHON_LIBRARIES}") +endif() + +if(PYTHONINTERP_FOUND AND UNIX AND CMAKE_BUILD_TYPE STREQUAL "Debug") + # This is for Debian + set(PYTHON_EXECUTABLE_TMP "${PYTHON_EXECUTABLE}-dbg") + + # Fall back to the standard interpreter. + if(NOT EXISTS "${PYTHON_EXECUTABLE_TMP}") + set(PYTHON_EXECUTABLE_TMP "${PYTHON_EXECUTABLE}") + endif() + + set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_TMP}") +endif() + -- cgit v1.2.3