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() 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)