FindPythonQt.cmake 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Find PythonQt
  2. #
  3. # Sets PYTHONQT_FOUND, PYTHONQT_INCLUDE_DIR, PYTHONQT_LIBRARY, PYTHONQT_LIBRARIES
  4. #
  5. # Python is required
  6. find_package(PythonLibs)
  7. if(NOT PYTHONLIBS_FOUND)
  8. message(FATAL_ERROR "error: Python is required to build PythonQt")
  9. endif()
  10. find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.")
  11. find_path(PYTHONQT_INCLUDE_DIR PythonQt.h "${PYTHONQT_INSTALL_DIR}/include/PythonQt" DOC "Path to the PythonQt include directory")
  12. find_library(PYTHONQT_LIBRARY PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
  13. mark_as_advanced(PYTHONQT_INSTALL_DIR)
  14. mark_as_advanced(PYTHONQT_INCLUDE_DIR)
  15. mark_as_advanced(PYTHONQT_LIBRARY)
  16. # On linux, also find libutil
  17. if(UNIX AND NOT APPLE)
  18. find_library(PYTHONQT_LIBUTIL util)
  19. mark_as_advanced(PYTHONQT_LIBUTIL)
  20. endif()
  21. set(PYTHONQT_FOUND 0)
  22. if(PYTHONQT_INCLUDE_DIR AND PYTHONQT_LIBRARY)
  23. # Currently CMake'ified PythonQt only supports building against a python Release build.
  24. # This applies independently of CTK build type (Release, Debug, ...)
  25. add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
  26. set(PYTHONQT_FOUND 1)
  27. set(PYTHONQT_LIBRARIES ${PYTHONQT_LIBRARY} ${PYTHONQT_LIBUTIL})
  28. endif()