I have a c++ library which has a python API library based on Boost.python included in the directory structure.
module
|_python_files
|_cpp_files
Is there a standard way to configure CMakelist so that it automatically adds the library containing the python files to PYTHONPATH?
In case you use FindPython you should be able to use
Python_add_library (my_module MODULE src1.cpp)
Or you could add the path to PYTHONPATH:
list(APPEND PYTHONPATH "${CMAKE_CURRENT_DIR}/module/python_files")
Otherwise, you want to add python_files to your python definition path:
export PYTHONPATH="${PYTHONPATH}:../module/python_files"
based on documentation this should od the trick:
set(ENV{PYTHONPATH} "${CMAKE_CURRENT_SOURCE_DIR}/module/python_files")
I didn't test that.
Note that PYTHONPATH environment variable is read and used by python interpreter not by cmake. It is used when trying locating python libraries imported by python code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With