diff options
author | Todd Lipcon <todd@cloudera.com> | 2015-06-25 21:45:27 (GMT) |
---|---|---|
committer | Todd Lipcon <todd@cloudera.com> | 2015-06-25 22:12:40 (GMT) |
commit | 91138150c6891a0f4a518974f443fdfff9575dc8 (patch) | |
tree | 49bbeb4998971291be62fcbdbf17cd64653244a0 | |
parent | 8a7bcead9b563ddc0490c462144c534b5d52f1e9 (diff) | |
download | lz4-91138150c6891a0f4a518974f443fdfff9575dc8.zip lz4-91138150c6891a0f4a518974f443fdfff9575dc8.tar.gz lz4-91138150c6891a0f4a518974f443fdfff9575dc8.tar.bz2 |
Fix cmake build to use gnu flags on clang
Previously, the cmake build was only adding -fPIC and -std=c99 on
gcc. However, these flags are also appropriate when building with
clang.
-rw-r--r-- | cmake_unofficial/CMakeLists.txt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmake_unofficial/CMakeLists.txt b/cmake_unofficial/CMakeLists.txt index 4c3eb65..a986f43 100644 --- a/cmake_unofficial/CMakeLists.txt +++ b/cmake_unofficial/CMakeLists.txt @@ -17,7 +17,12 @@ ENDIF() option(BUILD_TOOLS "Build the command line tools" ON) option(BUILD_LIBS "Build the libraries in addition to the tools" ON) -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) +IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR + "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") + SET(GNU_COMPATIBLE_COMPILER 1) +ENDIF() + +if(GNU_COMPATIBLE_COMPILER) if(UNIX AND BUILD_LIBS) add_definitions(-fPIC) endif() @@ -68,7 +73,7 @@ endif() if(MSVC) ADD_DEFINITIONS("-W4") endif() -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) +if(GNU_COMPATIBLE_COMPILER) ADD_DEFINITIONS("-Wall") endif() if(CMAKE_COMPILER_IS_GNUCXX) @@ -78,7 +83,7 @@ ADD_DEFINITIONS("-Wshadow") ADD_DEFINITIONS("-Wcast-align") ADD_DEFINITIONS("-Wstrict-prototypes") endif(CMAKE_COMPILER_IS_GNUCXX) -if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND +if(GNU_COMPATIBLE_COMPILER AND (NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")) ADD_DEFINITIONS("-std=c99") endif() |