[dev-util/cmake] Add improved Python patch for testing wrt bug #405181.
[proj/kde.git] / dev-util / cmake / files / cmake-2.8.10.2-FindPythonLibs.patch
1 diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake\r
2 index bffa9fb..8fc90ee 100644\r
3 --- a/Modules/FindPythonLibs.cmake\r
4 +++ b/Modules/FindPythonLibs.cmake\r
5 @@ -74,6 +74,19 @@ set(_Python_VERSIONS\r
6    ${_PYTHON_FIND_OTHER_VERSIONS}\r
7    )\r
8  \r
9 +# Gentoo portage requries that you use exactly the given python version\r
10 +if (CMAKE_BUILD_TYPE STREQUAL Gentoo)\r
11 +    execute_process(COMMAND python -c "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))"\r
12 +                    OUTPUT_VARIABLE _Gentoo_Python_VERSION)\r
13 +    list(FIND _Python_VERSIONS "${_Gentoo_Python_VERSION}" _Gentoo_Python_INDEX)\r
14 +    if (_Gentoo_Python_INDEX EQUAL -1)\r
15 +       # the current Gentoo python version is not compatible with what is requested\r
16 +       set(_Python_VERSIONS)\r
17 +    else ()\r
18 +       set(_Python_VERSIONS "${_Gentoo_Python_VERSION}")\r
19 +    endif ()\r
20 +endif()\r
21 +\r
22  unset(_PYTHON_FIND_OTHER_VERSIONS)\r
23  unset(_PYTHON1_VERSIONS)\r
24  unset(_PYTHON2_VERSIONS)\r