[release/9.0-preview7] Ensure linux uses zlib-ng and not system ZLIB #105354
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Backport of #105352 to release/9.0-preview7
/cc @carlossanlop @am11
Customer Impact
We needed to add logic to cmake that would decide which zlib version to use depending if the
CLR_CMAKE_USE_SYSTEM_ZLIBvariable was turned on or not. Currently we were always using the in-tree zlib-ng, but there were cases where we needed to turn that variable on via the command line. The fix was to add a generator expression (it's a condition) to select between the system installed zlib and the in-tree zlib-ng. But the condition was malformed, causing us to always select the system installed zlib.The fix is simply to wrap the
CLR_CMAKE_USE_SYSTEM_ZLIBkeyword in the condition with${}so it gets evaluated properly.Regression
It was working fine a few days ago until we introduced a malformed generator expression in cmake.
Testing
Manually verified with the local build.
Risk
Low - The build was working correctly until we introduced a malformed generator expression in cmake.