diff --git a/src/python/PyImathNumpy/CMakeLists.txt b/src/python/PyImathNumpy/CMakeLists.txt index 7b4f6b22..392453c2 100644 --- a/src/python/PyImathNumpy/CMakeLists.txt +++ b/src/python/PyImathNumpy/CMakeLists.txt @@ -22,7 +22,9 @@ if(TARGET Python2::Python AND LIBRARY_OUTPUT_NAME "imathnumpy" DEBUG_POSTFIX "" ) - install(TARGETS imathnumpy_python2 DESTINATION ${PyImath_Python2_SITEARCH_REL}) + install(TARGETS imathnumpy_python2 + DESTINATION "${CMAKE_INSTALL_BINDIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" + ) endif() if(TARGET Python3::Python AND @@ -48,5 +50,7 @@ if(TARGET Python3::Python AND LIBRARY_OUTPUT_NAME "imathnumpy" DEBUG_POSTFIX "" ) - install(TARGETS imathnumpy_python3 DESTINATION ${PyImath_Python3_SITEARCH_REL}) + install(TARGETS imathnumpy_python3 + DESTINATION "${CMAKE_INSTALL_BINDIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" + ) endif() diff --git a/src/python/config/ModuleDefine.cmake b/src/python/config/ModuleDefine.cmake index adee61c8..41cb7ea6 100644 --- a/src/python/config/ModuleDefine.cmake +++ b/src/python/config/ModuleDefine.cmake @@ -53,12 +53,6 @@ function(PYIMATH_ADD_LIBRARY_PRIV libname) ) add_library(${PROJECT_NAME}::${libname} ALIAS ${libname}) - - install(TARGETS ${libname} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) endfunction() # NB: This function has a number if specific names / variables @@ -130,7 +124,10 @@ function(PYIMATH_DEFINE_MODULE modname) LIBRARY_OUTPUT_NAME "${modname}" DEBUG_POSTFIX "" ) - install(TARGETS ${modname}_python2 DESTINATION ${PyImath_Python2_SITEARCH_REL}) + install(TARGETS ${modname}_python2 + EXPORT ${PROJECT_NAME} + DESTINATION "${CMAKE_INSTALL_BINDIR}/python${Python2_VERSION_MAJOR}.${Python2_VERSION_MINOR}/site-packages" + ) endif() else() if(TARGET Python3::Python) @@ -157,7 +154,10 @@ function(PYIMATH_DEFINE_MODULE modname) LIBRARY_OUTPUT_NAME "${modname}" DEBUG_POSTFIX "" ) - install(TARGETS ${modname}_python3 DESTINATION ${PyImath_Python3_SITEARCH_REL}) + install(TARGETS ${modname}_python3 + EXPORT ${PROJECT_NAME} + DESTINATION "${CMAKE_INSTALL_BINDIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" + ) endif() endif() endfunction()