Skip to content

Commit 3e5bbb0

Browse files
irevoirefvennetier
authored andcommitted
[CMAKE] add an error message if you are not using gcc as a compiler
(cherry picked from commit 840493d)
1 parent 14542c2 commit 3e5bbb0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ if (CMAKE_COMPILER_IS_GNUCC)
5454
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winline")
5555
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
5656
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wswitch-enum")
57+
else()
58+
message("The default compiler set in CC is not supported.")
59+
message("You need to use gcc with a version >= 4.2. ")
60+
message("You can set your default compiler either by updating your CC variable environment:")
61+
message("export CC=/path/to/gcc")
62+
message("Or by adding a flag when calling CMake: ")
63+
message("-D CMAKE_C_COMPILER=gcc")
64+
message( FATAL_ERROR "CMake will exit.")
5765
endif()
5866
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_CFLAGS}")
5967

0 commit comments

Comments
 (0)