Parcourir la source

Ensure PYTHONQT_INSTALL_DIR is not reset in project including CTK

This commit is an attempt to fix a regression introduced by fc92239
that was causing the Slicer packaging to fail (mainly because the
variable PYTHONQT_INSTALL_DIR was reset to an empty value after
"find_path" was called in FindPythonQt.cmake)

Note that this a workaround, the issue is being discussed with CMake
developer.
Jean-Christophe Fillion-Robin il y a 10 ans
Parent
commit
05ae7f3c83
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      Utilities/CMake/FindPythonQt.cmake

+ 3 - 1
Utilities/CMake/FindPythonQt.cmake

@@ -9,7 +9,9 @@ if(NOT PYTHONLIBS_FOUND)
   message(FATAL_ERROR "error: Python is required to build PythonQt")
 endif()
 
-find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.")
+if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}")
+  find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.")
+endif()
 find_path(PYTHONQT_INCLUDE_DIR PythonQt.h "${PYTHONQT_INSTALL_DIR}/include/PythonQt" DOC "Path to the PythonQt include directory")
 find_library(PYTHONQT_LIBRARY_RELEASE PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
 find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt${CTK_CMAKE_DEBUG_POSTFIX} PythonQt${CMAKE_DEBUG_POSTFIX} PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")