<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 22, 2018 at 4:36 AM Alexander Bürger <<a href="mailto:alexanderb@met.no">alexanderb@met.no</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr" style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">Hi,<div><br></div><div>I am trying to find a good way to compile a python module for a c++ library using boost-python for both python2 and python3 in the same compilation. So far, <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">The only solution I found for using</span></div></div></div></blockquote><div><br></div><div>The headers CMake needs to find are different depending on the selected version, because the CPython API changed between 2 and 3. The ABI is also not guaranteed to be stable within 3.x minor versions unless you set <span style="color:rgb(36,39,41);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;text-align:left;white-space:pre-wrap;background-color:rgb(239,240,241);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Py_LIMITED_API</span> (see e.g. <a href="https://stackoverflow.com/questions/28830653/build-boost-with-multiple-python-versions">https://stackoverflow.com/questions/28830653/build-boost-with-multiple-python-versions</a>).</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr" style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><div>FIND_PACKAGE(PythonInterp REQUIRED)</div><div>FIND_PACKAGE(PythonLibs REQUIRED)<br></div></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><div>FIND_PACKAGE(Boost REQUIRED COMPONENTS python # or python3)</div><div><br></div></div>with different python versions is to use one CMakeLists.txt per python version, each in a subdirectory, and with almost equal contents. I would appreciate suggestions for a better approach, with less duplication.</div><div><br></div><div>Best regards,</div><div><br></div><div>Alexander Bürger</div><div>MET Norway</div></div><br></div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div></div>