From c744be70602631afe1d66aa7876823504d207a2b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 24 Jan 2023 12:51:52 -0500 Subject: [PATCH 1/2] forcibly disable COMPRESS package is zlib is not found --- cmake/Modules/Packages/COMPRESS.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/Packages/COMPRESS.cmake b/cmake/Modules/Packages/COMPRESS.cmake index bdcf1aa3f8..4e1ab846a7 100644 --- a/cmake/Modules/Packages/COMPRESS.cmake +++ b/cmake/Modules/Packages/COMPRESS.cmake @@ -1,4 +1,9 @@ -find_package(ZLIB REQUIRED) +find_package(ZLIB) +if(NOT ZLIB_FOUND) + message(WARNING "No Zlib development support found. Disabling COMPRESS package...") + set(PKG_COMPRESS OFF CACHE BOOL "" FORCE) + return() +endif() target_link_libraries(lammps PRIVATE ZLIB::ZLIB) find_package(PkgConfig QUIET) From 4c996eed3beb9f970231c9fcbb99e096f93bfd44 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 24 Jan 2023 23:22:55 -0500 Subject: [PATCH 2/2] auto-enabling prerequisite packages with CMake --- cmake/Modules/LAMMPSUtils.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/LAMMPSUtils.cmake b/cmake/Modules/LAMMPSUtils.cmake index d42f91f10e..9b42dafc44 100644 --- a/cmake/Modules/LAMMPSUtils.cmake +++ b/cmake/Modules/LAMMPSUtils.cmake @@ -99,8 +99,15 @@ function(check_for_autogen_files source_dir) endfunction() macro(pkg_depends PKG1 PKG2) - if(PKG_${PKG1} AND NOT (PKG_${PKG2} OR BUILD_${PKG2})) - message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be built with the ${PKG2} package") + if(DEFINED BUILD_${PKG2}) + if(PKG_${PKG1} AND NOT BUILD_${PKG2}) + message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be built with -D BUILD_${PKG2}=ON") + endif() + elseif(DEFINED PKG_${PKG2}) + if(PKG_${PKG1} AND NOT PKG_${PKG2}) + message(WARNING "The ${PKG1} package depends on the ${PKG2} package. Enabling it.") + set(PKG_${PKG2} ON CACHE BOOL "" FORCE) + endif() endif() endmacro()