--- a/swig/python/CMakeLists.txt 2020-02-19 12:24:05.000000000 +0000 +++ b/swig/python/CMakeLists.txt 2020-02-20 14:54:59.279634000 +0000 @@ -20,9 +20,11 @@ file(COPY "examples" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))" - OUTPUT_VARIABLE PYTHON_MODULE_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE ) +if(NOT DEFINED PYTHON_MODULE_PATH) + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))" + OUTPUT_VARIABLE PYTHON_MODULE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE ) +endif() install( TARGETS _${PYTHON_SWIG_BINDING} DESTINATION ${PYTHON_MODULE_PATH}) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_SWIG_BINDING}.py" DESTINATION ${PYTHON_MODULE_PATH})