diff options
author | Lv Meng <meng.lv@intel.com> | 2014-12-01 11:45:52 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-12-15 09:42:14 +0800 |
commit | f0540fca21021bcd0ef2c5a7c22d5b38ca1f366b (patch) | |
tree | 1a4282bb5e1c9485bdc37457f8a0947064925657 /CMakeLists.txt | |
parent | d32db40dcb231c65ac400c8ab7a719176c0c1595 (diff) | |
download | beignet-f0540fca21021bcd0ef2c5a7c22d5b38ca1f366b.tar.gz |
Fix a makefile bug for gcc is not the default compiler
If no compiler macro is defined and the system only has clang
or icc, the previous implementation will treat clang as gcc and
will set some incorrect parameters. Now fix it.
Signed-off-by: Lv Meng <meng.lv@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 49c89291..369aba73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ # compiler choose,now support ICC,GCC CLANG compiler -set (COMPILER "GCC" CACHE INT "Compiler to choose on Linux (GCC,ICC,CLANG)") if (COMPILER STREQUAL "GCC") + find_program(CMAKE_C_COMPILER NAMES gcc) + find_program(CMAKE_CXX_COMPILER NAMES g++) elseif (COMPILER STREQUAL "CLANG") set (CMAKE_C_COMPILER "clang") set (CMAKE_CXX_COMPILER "clang++") @@ -19,7 +20,13 @@ set (LIBCL_DRIVER_VERSION_MAJOR 1) set (LIBCL_DRIVER_VERSION_MINOR 0) set (LIBCL_C_VERSION_MAJOR 1) set (LIBCL_C_VERSION_MINOR 2) - +if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + set(COMPILER "CLANG") +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + set(COMPILER "GCC") +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") + set(COMPILER "ICC") +endif() configure_file ( "src/OCLConfig.h.in" "src/OCLConfig.h" |