qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1414961 - /qpid/proton/trunk/proton-c/CMakeLists.txt
Date Wed, 28 Nov 2012 22:08:59 GMT
Author: astitcher
Date: Wed Nov 28 22:08:58 2012
New Revision: 1414961

URL: http://svn.apache.org/viewvc?rev=1414961&view=rev
Log:
NO-JIRA: Beaf up the detection of uuid_* and clock_gettime functions

Modified:
    qpid/proton/trunk/proton-c/CMakeLists.txt

Modified: qpid/proton/trunk/proton-c/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/CMakeLists.txt?rev=1414961&r1=1414960&r2=1414961&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/CMakeLists.txt Wed Nov 28 22:08:58 2012
@@ -18,6 +18,9 @@
 #
 cmake_minimum_required (VERSION 2.6)
 
+include(CheckLibraryExists)
+include(CheckSymbolExists)
+
 project (Proton C)
 
 set (PN_VERSION_MAJOR 0)
@@ -101,16 +104,34 @@ if (SWIG_FOUND)
   add_subdirectory(bindings)
 endif (SWIG_FOUND)
 
-# Should really be finding the library appropriate for the platform
-# in lieu of doing this set the library name directly.
-set (UUID_LIB uuid)
-set (TIME_LIB rt)
+# When checking for clock_gettime etc. first check whether the symbol
+# is present in the library that it may be in, if it is not then check
+# whether the symbol works using just the regular C library
+CHECK_LIBRARY_EXISTS (rt clock_gettime "" CLOCK_GETTIME_IN_RT)
+if (CLOCK_GETTIME_IN_RT)
+  set (TIME_LIB rt)
+else (CLOCK_GETTIME_IN_RT)
+  CHECK_SYMBOL_EXISTS(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
+  if (NOT HAVE_CLOCK_GETTIME)
+    message(FATAL_ERROR "clock_gettime() not found")
+  endif (NOT HAVE_CLOCK_GETTIME)
+endif (CLOCK_GETTIME_IN_RT)
+
+CHECK_LIBRARY_EXISTS (uuid uuid_generate "" UUID_GENERATE_IN_UUID)
+if (UUID_GENERATE_IN_UUID)
+  set (UUID_LIB uuid)
+else (UUID_GENERATE_IN_UUID)
+  CHECK_SYMBOL_EXISTS(uuid_generate "uuid/uuid.h" HAVE_UUID_GENERATE)
+  if (NOT HAVE_UUID_GENERATE)
+    message(FATAL_ERROR "uuid_generate() not found")
+  endif (NOT HAVE_UUID_GENERATE)
+endif (UUID_GENERATE_IN_UUID)
 
 # Set any additional platform specific C compiler flags
 if (CMAKE_COMPILER_IS_GNUCC)
-   set (COMPILE_WARNING_FLAGS "-Wall -Werror -pedantic-errors")
-   set (COMPILE_LANGUAGE_FLAGS "-std=c99")
-   set (COMPILE_PLATFORM_FLAGS "-std=gnu99")
+  set (COMPILE_WARNING_FLAGS "-Wall -Werror -pedantic-errors")
+  set (COMPILE_LANGUAGE_FLAGS "-std=c99")
+  set (COMPILE_PLATFORM_FLAGS "-std=gnu99")
 endif (CMAKE_COMPILER_IS_GNUCC)
 
 add_subdirectory(docs/api)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message