From 89db53e7cd3ee1fcc86bc982d8cb8e8d4fe05a2b 2013-08-03 13:36:19 From: Orochimarufan Date: 2013-08-03 13:36:19 Subject: [PATCH] More PythonQt*Config.cmake fixes --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f0d62ce..4340699 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ project(PythonQt) cmake_minimum_required(VERSION 2.8.10) +IF(POLICY CMP0020) + cmake_policy(SET CMP0020 NEW) +ENDIF() + include(CTestUseLaunchers OPTIONAL) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) diff --git a/cmake/FindPython.cmake b/cmake/FindPython.cmake index 17944d8..13dd988 100644 --- a/cmake/FindPython.cmake +++ b/cmake/FindPython.cmake @@ -132,17 +132,23 @@ ELSE() SET(_PYTHON_SC_INCLUDE "distutils.sysconfig.get_python_inc()") ENDIF() -EXECUTE_PROCESS( - COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LIBDIR'))" - OUTPUT_VARIABLE _PYTHON_LIBRARY_PATH -) IF(WIN32) EXECUTE_PROCESS( - COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LIBRARY'))" - OUTPUT_VARIABLE _PYTHON_LIBRARY_NAME + COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('prefix'))" + OUTPUT_VARIABLE _PYTHON_PREFIX + ) + EXECUTE_PROCESS( + COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('py_version_nodot'))" + OUTPUT_VARIABLE _PYTHON_VERSION_MAJOR ) + SET(_PYTHON_LIBRARY_PATH ${_PYTHON_PREFIX}/libs) + SET(_PYTHON_LIBRARY_NAME libpython${_PYTHON_VERSION_MAJOR}.a) ELSE(WIN32) EXECUTE_PROCESS( + COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LIBDIR'))" + OUTPUT_VARIABLE _PYTHON_LIBRARY_PATH + ) + EXECUTE_PROCESS( COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LDLIBRARY'))" OUTPUT_VARIABLE _PYTHON_LIBRARY_NAME ) diff --git a/extensions/PythonQt_QtAll/CMakeLists.txt b/extensions/PythonQt_QtAll/CMakeLists.txt index e601815..c1bb953 100644 --- a/extensions/PythonQt_QtAll/CMakeLists.txt +++ b/extensions/PythonQt_QtAll/CMakeLists.txt @@ -179,7 +179,7 @@ export(PACKAGE ${PythonQt_QtAll}) set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Config.cmake" @ONLY) # install tree -set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") +set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/PythonQt") configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake" @ONLY) # both configure_file(PythonQt_QtAllConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake" @ONLY) diff --git a/extensions/PythonQt_QtAll/PythonQt_QtAllConfig.cmake.in b/extensions/PythonQt_QtAll/PythonQt_QtAllConfig.cmake.in index 227f76f..009f4d0 100644 --- a/extensions/PythonQt_QtAll/PythonQt_QtAllConfig.cmake.in +++ b/extensions/PythonQt_QtAll/PythonQt_QtAllConfig.cmake.in @@ -1,6 +1,5 @@ # - Config file for the PythonQt package # It defines the following variables -# PythonQt - the PythonQt core target (PythonQt PythonQt_3 PythonQt5 PythonQt5_3) # PythonQt_QtAll - the PythonQt QtAll target # PythonQt_QtAll_INCLUDE_DIRS - include directories for PythonQt # PythonQt_QtAll_LIBRARIES - libraries to link against @@ -9,8 +8,6 @@ set(PythonQt_QtAll @PythonQt_QtAll@) set(PythonQt_QtAll_QT @QT@) -find_package(@PythonQt@) - # Compute paths get_filename_component(PYTHONQT_QTALL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) set(PythonQt_QtAll_INCLUDE_DIRS "@INCLUDE_DIRS@") @@ -20,5 +17,7 @@ if(NOT TARGET @PythonQt_QtAll@) include("${PYTHONQT_QTALL_CMAKE_DIR}/@PythonQt_QtAll@Targets.cmake") endif() +find_package(@PythonQt@) + # These are IMPORTED targets created by @PythonQt_QtAll@Targets.cmake -set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@ @PythonQt@) +set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9f4dd1e..43c4f1a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,4 @@ project(PythonQt_Core) -cmake_minimum_required(VERSION 2.8.10) #----------------------------------------------------------------------------- # Sources @@ -80,6 +79,7 @@ set(SOURCES_QRC ) #----------------------------------------------------------------------------- # Build the library include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +add_definitions(-DPYTHONQT_EXPORTS) qt_wrap_cpp(GEN_MOC ${SOURCES_MOC}) qt_add_resources(GEN_QRC ${SOURCES_QRC}) @@ -125,7 +125,7 @@ export(PACKAGE ${PythonQt}) set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}Config.cmake" @ONLY) # install tree -set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") +set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/PythonQt") configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake" @ONLY) # both configure_file(PythonQtConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake" @ONLY)