From 15b07e60a7db17fff76cf0964151c93bb1cf58bb Mon Sep 17 00:00:00 2001 From: Pariterre Date: Fri, 19 Jul 2019 14:48:49 +0200 Subject: [PATCH] Added the capability to use swig4.0 --- binding/python3/CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/binding/python3/CMakeLists.txt b/binding/python3/CMakeLists.txt index d3f2eb4c..19c89455 100644 --- a/binding/python3/CMakeLists.txt +++ b/binding/python3/CMakeLists.txt @@ -34,8 +34,16 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.py INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py DESTINATION ${Python3_SITELIB}/${PROJECT_NAME}) -# For some reason, I could not install the library directly into subfolder -# Some day this should be fixed... +# Check if swig has its version 3 or 4, to choose the right place to put the library +if(${SWIG_VERSION} MATCHES "^3(\.[0-9]*)*$") + set(PYTHON_INSTALL_DESTINATION ${Python3_SITELIB}) +elseif(${SWIG_VERSION} MATCHES "^4(\.[0-9]*)*$") + set(PYTHON_INSTALL_DESTINATION ${Python3_SITELIB}/${PROJECT_NAME}) +else() + message( FATAL_ERROR "Swig must be version 3 or 4" ) +endif() + +# Install the library INSTALL(TARGETS _${PROJECT_NAME} - DESTINATION ${Python3_SITELIB}) + DESTINATION ${PYTHON_INSTALL_DESTINATION})