boostorg / cmake

CMake support infrastructure Boost submodule
86 stars 26 forks source link

How to specify multiple Python versions to build Boost.Python #69

Open yurybura opened 2 months ago

yurybura commented 2 months ago

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.

pdimov commented 2 months ago

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

yurybura commented 2 months ago

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.

pdimov commented 2 months ago

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.

yurybura commented 2 months ago

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.