diff options
| author | David Faure <faure@kde.org> | 2016-11-07 15:01:51 +0100 | 
|---|---|---|
| committer | David Faure <faure@kde.org> | 2016-11-07 15:01:51 +0100 | 
| commit | 06359725f5180d052b81369e56812efc561618e3 (patch) | |
| tree | 435aded551ea73203c44989009c6720bca79b14a /tests | |
| parent | 1232d857690f21b30af553d52513c94be6d29e29 (diff) | |
| download | extra-cmake-modules-06359725f5180d052b81369e56812efc561618e3.tar.gz extra-cmake-modules-06359725f5180d052b81369e56812efc561618e3.tar.bz2  | |
Skip Python bindings test if PyQt isn't installed
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/CMakeLists.txt | 37 | 
1 files changed, 24 insertions, 13 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2fad234f..88975499 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -81,22 +81,33 @@ endmacro()  list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/find-modules) -find_package(PythonModuleGeneration) +# Skip if PyQt not available +find_file(SIP_Qt5Core_Mod_FILE +    NAMES QtCoremod.sip +    PATH_SUFFIXES share/sip/PyQt5/QtCore +) -foreach(pyversion 2 3) -  if (GPB_PYTHON${pyversion}_COMMAND) -    if (pythonCommands) -      list(APPEND pythonCommands " && ") +if(NOT SIP_Qt5Core_Mod_FILE) +    message(STATUS "WARNING: skipping tests that require PyQt") +else() +  find_package(PythonModuleGeneration) +  foreach(pyversion 2 3) +    if (GPB_PYTHON${pyversion}_COMMAND) +      if (pythonCommands) +        list(APPEND pythonCommands " && ") +      endif() +      set(pythonCommands +        ${GPB_PYTHON${pyversion}_COMMAND} +        "${CMAKE_CURRENT_SOURCE_DIR}/GenerateSipBindings/testscript.py" +        "${CMAKE_CURRENT_BINARY_DIR}/GenerateSipBindings/py${pyversion}" +      )      endif() -    set(pythonCommands -      ${GPB_PYTHON${pyversion}_COMMAND} -      "${CMAKE_CURRENT_SOURCE_DIR}/GenerateSipBindings/testscript.py" -      "${CMAKE_CURRENT_BINARY_DIR}/GenerateSipBindings/py${pyversion}" -    ) +  endforeach() +  if (pythonCommands) +    add_test_macro(GenerateSipBindings ${pythonCommands}) + else() +    message(STATUS "WARNING: skipping GenerateSipBindings test")    endif() -endforeach() -if (pythonCommands) -  add_test_macro(GenerateSipBindings ${pythonCommands})  endif()  add_test_macro(ExecuteCoreModules dummy)  | 
