Merge pull request #616 from iburinoc/cmake

CMake: Fix version parsing and allow Unix flags on Clang
This commit is contained in:
Yann Collet 2017-03-21 14:01:42 -07:00 committed by GitHub
commit c9dcdeacbc
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ function(EnableCompilerFlag _flag _C _CXX)
endfunction()
MACRO(ADD_EXTRA_COMPILATION_FLAGS)
if (CMAKE_COMPILER_IS_GNUCXX OR MINGW) #Not only UNIX but also WIN32 for MinGW
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" OR MINGW) #Not only UNIX but also WIN32 for MinGW
#Set c++11 by default
EnableCompilerFlag("-std=c++11" false true)
#Set c99 by default

View File

@ -2,7 +2,7 @@ function(GetLibraryVersion _header _major _minor _release)
# Read file content
FILE(READ ${_header} CONTENT)
string(REGEX MATCHALL ".*define ZSTD_VERSION_MAJOR+.* ([0-9]+).*define ZSTD_VERSION_MINOR+.* ([0-9]+).*define ZSTD_VERSION_RELEASE+.* ([0-9]+)" VERSION_REGEX "${CONTENT}")
string(REGEX MATCH ".*define ZSTD_VERSION_MAJOR *([0-9]+).*define ZSTD_VERSION_MINOR *([0-9]+).*define ZSTD_VERSION_RELEASE *([0-9]+)" VERSION_REGEX "${CONTENT}")
SET(${_major} ${CMAKE_MATCH_1} PARENT_SCOPE)
SET(${_minor} ${CMAKE_MATCH_2} PARENT_SCOPE)
SET(${_release} ${CMAKE_MATCH_3} PARENT_SCOPE)