summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-06-26 04:21:24 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-06-26 04:21:24 (GMT)
commit992faef5a2dba1d143d113f3a53a5841f5f75fc4 (patch)
tree20d9d887eac2329c763d5caefb1be76e64f35d9c
parent3d9adf7afcd67c98c2851d6b8898781fda530e9a (diff)
parent91138150c6891a0f4a518974f443fdfff9575dc8 (diff)
downloadlz4-992faef5a2dba1d143d113f3a53a5841f5f75fc4.zip
lz4-992faef5a2dba1d143d113f3a53a5841f5f75fc4.tar.gz
lz4-992faef5a2dba1d143d113f3a53a5841f5f75fc4.tar.bz2
Merge pull request #124 from toddlipcon/master
Fix cmake build to use gnu flags on clang
-rw-r--r--cmake_unofficial/CMakeLists.txt11
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()