diff --git a/CMakeLists.txt b/CMakeLists.txt index 54d4817..300a6a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,7 +156,9 @@ endif() if(NOT DEACTIVATE_ZLIB) # import the ZLIB_ROOT environment variable to help finding the zlib library if(PREFER_EXTERNAL_ZLIB) - set(ZLIB_ROOT $ENV{ZLIB_ROOT}) + if(NOT DEFINED ZLIB_ROOT) + set(ZLIB_ROOT $ENV{ZLIB_ROOT}) + endif() find_package(ZLIB) if(NOT ZLIB_FOUND ) message(STATUS "No zlib found. Using internal sources.")