<table><tr><td style="">turbov added inline comments.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D8780" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D8780#inline-38714" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">cgiboudeaux</span> wrote in <span style="color: #4b4d51; font-weight: bold;">FindPythonModuleGeneration.cmake:212</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">NAMES clang clang-3.8 clang-3.9</pre></div>
<p style="padding: 0; margin: 8px;">and remove the lines 234-239</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">What distribution is this? Why only 3.8 and 3.9?? Why not 4.0 or 5.0???</p>
<p style="padding: 0; margin: 8px;">I've just checked Ubuntu 14.04 (Clang 3.3 to 3.9 available) and 17.10 (up to 5.0 available)... installing <tt style="background: #ebebeb; font-size: 13px;">libclang-X.Y</tt> (or <tt style="background: #ebebeb; font-size: 13px;">libclang-X.Y-devel</tt> obviously) always bring <tt style="background: #ebebeb; font-size: 13px;">libclang.so</tt> library (which is of cause a symlink to a versioned name), but it always here... Also, I've checked CentOS 7 w/ <a href="https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/" class="remarkup-link" target="_blank" rel="noreferrer">DTS7</a> (Clang 4.0) -- same here...</p>
<p style="padding: 0; margin: 8px;">so the question is "why to search a versioned name?" -- I don't know any distro where <tt style="background: #ebebeb; font-size: 13px;">libclang.so</tt> is not available... do you?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D8780#inline-38715" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">cgiboudeaux</span> wrote in <span style="color: #4b4d51; font-weight: bold;">FindPythonModuleGeneration.cmake:213</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">Replace PATH with HINTS.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Why <tt style="background: #ebebeb; font-size: 13px;">HINTS</tt> is "better"?? As for me this is not a "hint" -- at this point we know exactly the correct libdir location... it is why I use <tt style="background: #ebebeb; font-size: 13px;">PATH</tt>...</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D8780#inline-38824" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">FindPythonModuleGeneration.cmake:217</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span style="color: #304a96"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span style="color: #766510"><span class="bright">libclang_LIBRARY</span></span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span style="color: #304a96"><span class="bright">message</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span style="color: #766510"><span class="bright">FATAL_ERROR</span></span><span class="bright"> </span><span style="color: #766510"><span class="bright">"The max libclang version in ${CMAKE_FIND_PACKAGE_NAME} must be updated."</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span style="color: #304a96"><span class="bright">endif</span></span><span class="bright"></span><span class="p"><span class="bright">(</span>)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"> </span><span style="color: #304a96"><span class="bright">else</span></span><span class="bright"></span><span class="p"><span class="bright">(</span>)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"> </span><span style="color: #74777d"><span class="bright"># Ok, try w/o `llvm-config` then...</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"> </span><span style="color: #304a96"><span class="bright">set</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span style="color: #766510"><span class="bright">_LIBCLANG_MAX_MAJOR_VERSION</span></span><span class="bright"> </span><span style="color: #766510"><span class="bright">7</span></span><span class="p">)</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">As for me, I would remove whole this part of "brute forcing" available clang version. I can't see how it could work w/o additional hints due a location of <tt style="background: #ebebeb; font-size: 13px;">libclang</tt> is not a standard directory (typically <tt style="background: #ebebeb; font-size: 13px;">/usr/lib/llvm-X.Y/</tt>) and no <tt style="background: #ebebeb; font-size: 13px;">HINTS</tt> given to <tt style="background: #ebebeb; font-size: 13px;">find_library</tt>...</p>
<p style="padding: 0; margin: 8px;">Also this code is really lack of flexibility: what if I have few versions of <tt style="background: #ebebeb; font-size: 13px;">clang</tt>, but want to use only particular one... (which is not a newest one)?? -- Nowadays, this scenario not handled at all...</p>
<p style="padding: 0; margin: 8px;">Instead, I propose to be not so aggressive:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">If a user has <tt style="background: #ebebeb; font-size: 13px;">clang</tt> installed, let's ask the version of it (<tt style="background: #ebebeb; font-size: 13px;">clang --version</tt>), then "guess" a library dir</li>
<li class="remarkup-list-item">if nothing found, then OK... just skip the generation of SIP files...</li>
<li class="remarkup-list-item">If a user has some private installation of Clang (possibly built somewhere in <tt style="background: #ebebeb; font-size: 13px;">/home/john/work/tools/clang/...</tt>) and really want to build Python bindings, let's give him an option to provide a libdir via CMake CLI (like <tt style="background: #ebebeb; font-size: 13px;">-DGPB_LIBCLANG_PATH=...</tt>)</li>
<li class="remarkup-list-item">If a user wants a particular version, he always can set a hint variable to the desired path...</li>
</ul></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R240 Extra CMake Modules</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8780" rel="noreferrer">https://phabricator.kde.org/D8780</a></div></div><br /><div><strong>To: </strong>turbov<br /><strong>Cc: </strong>cgiboudeaux, shaheed, Frameworks, Build System<br /></div>