XCode Version 4.4.1
cmake version 2.8.9
clang version 3.2 (trunk 167618)
This was apparently not an issue in an earlier version we were using (ab844899a92f46e2d880c38c85ce098933533aef)
But in today's head revision (628eb9865179bbdbdcd88c1f7aa238d6dd037530), the CMake build runs into problems on OS X because of the non-ansi version of tcpd.h.
The reason the earlier snapshot (ab844899) worked is that WITH_TCPWRAPPER was only defined in the configure script -- it wasn't dealt with at all in the CMake build files.
Currently there is an addition of a FindWrap.cmake that is used to find tcpd.h and libwrap, but it doesn't try to compile a program including tcpd.h to determine if it has C++-compatible headers.
So the compilation fails in dcmnet/libsrc/dul.cc
The following code fixes FindWrap.cmake.
Code: Select all
diff --git a/CMake/FindWrap.cmake b/CMake/FindWrap.cmake
index 5737e41..1eac629 100644
--- a/CMake/FindWrap.cmake
+++ b/CMake/FindWrap.cmake
@@ -19,6 +19,23 @@ MARK_AS_ADVANCED(WRAP_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WRAP REQUIRED_VARS WRAP_LIBRARY WRAP_INCLUDE_DIR)
+#
+# ftpd.h doesn't by default include ansi prototypes for the wrap library
+DCMTK_TRY_COMPILE(_WRAP_FOUND "Can include tcpd.h in a C++ source file"
+"// minimal test for ftpd.h
+#include <tcpd.h>
+#include <syslog.h>
+int main(int,char *[])
+{
+ struct request_info request;
+ (void)hosts_access(&request);
+ return 0;
+}
+")
+if(NOT _WRAP_FOUND)
+set(WRAP_FOUND 0)
+endif()
+
# Copy the result to output variables
IF(WRAP_FOUND)
SET(WRAP_LIBRARIES ${WRAP_LIBRARY})