diff options
author | Alan Antonuk <aega@med.umich.edu> | 2012-09-11 11:06:47 -0400 |
---|---|---|
committer | Alan Antonuk <aega@med.umich.edu> | 2012-09-11 11:06:47 -0400 |
commit | 72e62343f54825fcb3e3d053aca8a83e6103b423 (patch) | |
tree | e728294d033541d719a0e7acc4a4bc220c5a565d /CMakeLists.txt | |
parent | 2c106129002ec50eeb554b3bd9447ffb8e6c0dea (diff) | |
download | rabbitmq-c-github-ask-72e62343f54825fcb3e3d053aca8a83e6103b423.tar.gz |
Set CMAKE_C_FLAGS appropritatly for a compiler
- Test to make sure we set flags only for GCC
- Only set -fvisibility=hidden for gcc 4.0 and above
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bb2381..7b60cfe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,13 @@ set(VERSION "0.2") if (MSVC) set(CMAKE_C_FLAGS "/W4 /nologo ${CMAKE_C_FLAGS}") -else () - set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wstrict-prototypes -Wcast-align -Wno-unused-function -fno-common -fvisibility=hidden ${CMAKE_C_FLAGS}") +elseif (CMAKE_COMPILER_IS_GNUCC) + set(RMQ_C_FLAGS "-Wall -Wextra -pedantic -Wstrict-prototypes -Wcast-align -Wno-unused-function -fno-common") + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 4.0 OR GCC_VERSION VERSION_EQUAL 4.0) + set(RMQ_C_FLAGS "${RMQ_C_FLAGS} -fvisibility=hidden") + endif() + set(CMAKE_C_FLAGS "${RMQ_C_FLAGS} ${CMAKE_C_FLAGS}") endif () if (NOT CMAKE_BUILD_TYPE) |