<div dir="ltr"><div>Hi Alexander.</div><div><br></div><div>No time for a full answer now, but a hint: it's possible to add_subdirectory() the same CMakeLists.txt multiple times, if you use a different binary dir each time. You can set some variables in the parent CMakeList and use them in the child one to generate slightly different projects from the same source.</div><div><br></div><div>Petr<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 22 June 2018 at 10:33, Alexander Bürger <span dir="ltr"><<a href="mailto:alexanderb@met.no" target="_blank">alexanderb@met.no</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;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><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>
<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/<wbr>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/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>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/<wbr>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/<wbr>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/<wbr>listinfo/cmake</a><br>
<br></blockquote></div><br></div>