cmake icon indicating copy to clipboard operation
cmake copied to clipboard

How to specify multiple Python versions to build Boost.Python

Open yurybura opened this issue 1 year ago • 4 comments

Is there an alternative to specifying and building multiple binaries for a Boost.Python project? For example, boost-python310 and boost-python312 are not compatible. How to build both binaries using CMake?

B2 provides the following solution: https://www.boost.org/doc/libs/1_85_0/tools/build/doc/html/index.html#bbv2.reference.tools.libraries.python.

yurybura avatar Jul 15 '24 11:07 yurybura

You should be able to set the Python_ROOT_DIR variable to point at the desired version.

pdimov avatar Jul 15 '24 12:07 pdimov

You should be able to set the Python_ROOT_DIR variable to point at the desired version.

With the B2 tool, you can specify multiple versions of Python in a single build using the python=3.10,3.12 command line option. B2 will create both libraries.

yurybura avatar Jul 15 '24 14:07 yurybura

I don't think this is possible with CMake. It doesn't support building the same target several times with different configurations like b2 does.

pdimov avatar Jul 15 '24 17:07 pdimov

I don't think this is possible with CMake. It doesn't support building the same target several times with different configurations like b2 does.

Many projects do this with CMake using ExternalProject_Add.

yurybura avatar Jul 15 '24 18:07 yurybura