diff options
author | Michael Steinert <mike.steinert@gmail.com> | 2012-05-25 15:40:47 -0600 |
---|---|---|
committer | Michael Steinert <mike.steinert@gmail.com> | 2012-05-27 10:39:58 -0600 |
commit | 8d9710238704e08ef2c1753698de94548d096f1b (patch) | |
tree | 051c7ae3ebc5408ce914fb54ead6105e2c08759d /CMakeLists.txt | |
parent | 6b9627fe2f520d6c0dd36851b9e384bc176108c5 (diff) | |
download | rabbitmq-c-github-ask-8d9710238704e08ef2c1753698de94548d096f1b.tar.gz |
Cleanup CMake build a bit
1. Add checks for Unix/Linux-specific header files (similar to
configure.ac)
2. Added a check for the `-std=c99` flag. It appears that some of this
code uses C99 and compiling without this flag produces quite a few
warnings.
Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d94a55..8b257ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,10 +11,36 @@ else () set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wstrict-prototypes -Wcast-align -Wno-unused-function -fno-common -fvisibility=hidden ${CMAKE_C_FLAGS}") endif () +include(CheckCCompilerFlag) + +check_c_compiler_flag("-std=c99" STD_C99) +if (STD_C99) + set(CMAKE_C_FLAGS "-std=c99") +endif (STD_C99) + +include(CheckIncludeFiles) + +check_include_files("arpa/inet.h" HAVE_ARPA_INET_H) +if (HAVE_ARPA_INET_H) + add_definitions(-DHAVE_ARPA_INET_H) +endif(HAVE_ARPA_INET_H) + +check_include_files("netdb.h" HAVE_NETDB_H) +if (HAVE_NETDB_H) + add_definitions(-DHAVE_NETDB_H) +endif(HAVE_NETDB_H) + +check_include_files("netinet/tcp.h" HAVE_NETINET_TCP_H) +if (HAVE_NETINET_TCP_H) + add_definitions(-DHAVE_NETINET_TCP_H) +endif (HAVE_NETINET_TCP_H) + if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() +add_definitions(-D_GNU_SOURCE) + #find python find_package(PythonInterp REQUIRED) |