-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zstd: don't require CMake 3.18 or later (#16260)
* Don't require CMake 3.18 or later * add package_type
- Loading branch information
Showing
3 changed files
with
41 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
recipes/zstd/all/patches/1.5.4-decrease-min-cmake-version.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake | ||
+++ b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake | ||
@@ -1,6 +1,15 @@ | ||
include(CheckCXXCompilerFlag) | ||
include(CheckCCompilerFlag) | ||
-include(CheckLinkerFlag) | ||
+# VERSION_GREATER_EQUAL requires CMake 3.7 or later. | ||
+# https://cmake.org/cmake/help/latest/command/if.html#version-greater-equal | ||
+if (CMAKE_VERSION VERSION_LESS 3.18) | ||
+ set(ZSTD_HAVE_CHECK_LINKER_FLAG false) | ||
+else () | ||
+ set(ZSTD_HAVE_CHECK_LINKER_FLAG true) | ||
+endif () | ||
+if (ZSTD_HAVE_CHECK_LINKER_FLAG) | ||
+ include(CheckLinkerFlag) | ||
+endif() | ||
|
||
function(EnableCompilerFlag _flag _C _CXX _LD) | ||
string(REGEX REPLACE "\\+" "PLUS" varname "${_flag}") | ||
@@ -20,7 +29,15 @@ function(EnableCompilerFlag _flag _C _CXX _LD) | ||
endif () | ||
endif () | ||
if (_LD) | ||
- CHECK_LINKER_FLAG(C ${_flag} LD_FLAG_${varname}) | ||
+ # We never add a linker flag with CMake < 3.18. We will | ||
+ # implement CHECK_LINKER_FLAG() like feature for CMake < 3.18 | ||
+ # or require CMake >= 3.18 when we need to add a required | ||
+ # linker flag in future. | ||
+ if (ZSTD_HAVE_CHECK_LINKER_FLAG) | ||
+ CHECK_LINKER_FLAG(C ${_flag} LD_FLAG_${varname}) | ||
+ else () | ||
+ set(LD_FLAG_${varname} false) | ||
+ endif () | ||
if (LD_FLAG_${varname}) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_flag}" PARENT_SCOPE) | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_flag}" PARENT_SCOPE) |