From 1df6299132d053af1e2bb3006214fa3092f47c59 Mon Sep 17 00:00:00 2001 From: Rafael Date: Thu, 22 Feb 2024 13:06:53 +0100 Subject: [PATCH] add independent flag for better control --- CMakeLists.txt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d40d31eb1..06f1a1aac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -464,15 +464,14 @@ if(ENABLE_PYTHON AND Python_FOUND) message(STATUS " development libraries: NOT found!") endif(Python_Development_FOUND) - # install in CMAKE_INSTALL_PREFIX if it is provided, or in the globably Python_SITELIB otherwise - set(Python_INSTALL_PACKAGE_DIR "") - if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(Python_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PREFIX}") - elseif() + + # use Python_INSTALL_PACKAGE_DIR if provided; otherwise, install in Python_SITELIB + if(NOT DEFINED Python_INSTALL_PACKAGE_DIR) set(Python_INSTALL_PACKAGE_DIR "${Python_SITELIB}") - endif(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + endif(NOT DEFINED Python_INSTALL_PACKAGE_DIR) message(STATUS " package install directory: ${Python_INSTALL_PACKAGE_DIR}") + # look for NumPy if(Python_NumPy_FOUND) set(CMAKE_SWIG_FLAGS -DWITHNUMPY ${CRP}) @@ -531,7 +530,6 @@ if(ENABLE_PYTHON AND Python_FOUND) target_link_libraries(crpropa-swig crpropa ${Python_LIBRARIES} ${Python_LIBRARY}) add_dependencies(crpropa-swig crpropa-swig-wrapper) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/python/crpropa" DESTINATION "${Python_INSTALL_PACKAGE_DIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/crpropa.py" DESTINATION "${Python_INSTALL_PACKAGE_DIR}/crpropa") install(TARGETS crpropa-swig LIBRARY DESTINATION "${Python_INSTALL_PACKAGE_DIR}/crpropa")