zzag added a comment.
Well, something like this works fine, though this is a quick and dirty solution. if (CMAKE_VERSION VERSION_LESS 3.12.0) find_package (PythonInterp 3 REQUIRED) set (_py_exe ${PYTHON_EXECUTABLE}) else () find_package (Python 3.0 REQUIRED COMPONENTS Interpreter) set (_py_exe ${Python_EXECUTABLE}) endif () execute_process (COMMAND "${_py_exe}" "-c" "import re, cairo; print(re.compile('/__init__.py.*').sub('',cairo.__file__))" RESULT_VARIABLE _PY_cairo_status OUTPUT_VARIABLE _PY_cairo_location ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) if (_PY_cairo_status EQUAL 0) set (PY_CAIRO ${_PY_cairo_location} CACHE STRING "Location of pycairo") endif () find_package_handle_standard_args (PythonCairo DEFAULT_MSG PY_CAIRO) REPOSITORY R98 Breeze for Gtk BRANCH master REVISION DETAIL https://phabricator.kde.org/D18244 To: davidedmundson, #plasma, ngraham Cc: ngraham, zzag, plasma-devel, sukalyanbanga, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart