Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sip_helper to use python header dirs #12

Merged
merged 2 commits into from
Jul 2, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmake/sip_helper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ set(__PYTHON_QT_BINDING_SIP_HELPER_INCLUDED TRUE)

set(__PYTHON_QT_BINDING_SIP_HELPER_DIR ${CMAKE_CURRENT_LIST_DIR})

find_package(PythonInterp REQUIRED)
set(Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package(PythonInterp "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
assert(PYTHON_EXECUTABLE)
find_package(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add the folllowing line before this:

set(Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")

It ensures that find_package() is able to find the specified Python version - even if the version number is unknown in the PythonLibs CMake config file.


find_program(SIP_EXECUTABLE sip)
if(NOT SIP_EXECUTABLE_NOTFOUND)
Expand Down Expand Up @@ -197,7 +199,7 @@ function(build_sip_binding PROJECT_NAME SIP_FILE)

set(SIP_BUILD_DIR ${sip_BINARY_DIR}/sip/${PROJECT_NAME})

set(INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS})
set(INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
set(LIBRARIES ${${PROJECT_NAME}_LIBRARIES})
set(LIBRARY_DIRS ${${PROJECT_NAME}_LIBRARY_DIRS})
set(LDFLAGS_OTHER ${${PROJECT_NAME}_LDFLAGS_OTHER})
Expand Down