From 1f11f5fb51b174189e83ed60477698bbefa56afb Mon Sep 17 00:00:00 2001 From: Marcin Wojdyr Date: Fri, 15 Dec 2023 21:18:31 +0100 Subject: [PATCH] build: fix gemmi-config.cmake and change defaults in pyproject.toml gemmi-config.cmake didn't work if ZLIB was not found and two unrelated changes: in CMakeLists.txt, python module is marked as COMPONENT py, so that it's possible to install only python module with: cmake --install --component py in pyproject.toml, setting BUILD_GEMMI_PROGRAM and INSTALL_DEV_FILES to OFF was removed, so it's ON by default. But it's set to off in cibuildwheel configuration. --- CMakeLists.txt | 4 ++-- pyproject.toml | 2 -- tools/gemmi-config.cmake.in | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bfe1efc5..fa61370fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,7 +161,7 @@ else() endif() set_property(TARGET ungz PROPERTY POSITION_INDEPENDENT_CODE ON) macro(support_gz exe) - target_sources(${exe} PUBLIC $) + target_sources(${exe} PRIVATE $) endmacro() endif() @@ -473,5 +473,5 @@ if (USE_PYTHON) # Using Python_SITEARCH/SITELIB is not good, because they are absolute # and don't respect CMAKE_INSTALL_PREFIX. # https://discourse.cmake.org/t/findpython3-how-to-specify-local-installation-directory-for-python-module/3580/5 - install(TARGETS gemmi_py DESTINATION "${Python_SITEARCH}") + install(TARGETS gemmi_py DESTINATION "${Python_SITEARCH}" COMPONENT py) endif() diff --git a/pyproject.toml b/pyproject.toml index cdfac9651..a46972561 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,8 +64,6 @@ cmake.build-type = "Release" cmake.verbose = true [tool.scikit-build.cmake.define] USE_PYTHON = "ON" -BUILD_GEMMI_PROGRAM = "OFF" -INSTALL_DEV_FILES = "OFF" [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" diff --git a/tools/gemmi-config.cmake.in b/tools/gemmi-config.cmake.in index 7910e40ee..3d36de4f8 100644 --- a/tools/gemmi-config.cmake.in +++ b/tools/gemmi-config.cmake.in @@ -1,7 +1,7 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) -find_dependency(ZLIB) +find_package(ZLIB) include("${CMAKE_CURRENT_LIST_DIR}/gemmi-targets.cmake")