[CMake] compiling for both python2 and python3

Alexander Bürger alexanderb at met.no
Fri Jun 22 04:33:04 EDT 2018


Hi,

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, The only solution I found for using

FIND_PACKAGE(PythonInterp REQUIRED)
FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(Boost REQUIRED COMPONENTS python # or python3)

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.

Best regards,

Alexander Bürger
MET Norway
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180622/58cf4f21/attachment.html>


More information about the CMake mailing list