]> The Tcpdump Group git mirrors - tcpdump/blobdiff - CMakeLists.txt
On Solaris, for 64-bit builds, use the 64-bit pcap-config.
[tcpdump] / CMakeLists.txt
index 95da37bc99d9eeb7afaf3ddf40c4980f5801a829..edd5fd19a79e85cc1866fa12ef38a76dadfc80d1 100644 (file)
@@ -32,6 +32,36 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
 
 project(tcpdump)
 
+#
+# OK, this is a royal pain.
+#
+# CMake will try to determine the sizes of some data types, including
+# void *, early in the process of configuration; apparently, it's done
+# as part of processing the project() command.
+#
+# At least as of CMake 2.8.6, it does so by checking the size of
+# "void *" in C, setting CMAKE_C_SIZEOF_DATA_PTR based on that,
+# setting CMAKE_SIZEOF_VOID_P to that, and then checking the size
+# of "void *" in C++, setting CMAKE_CXX_SIZEOF_DATA_PTR based on
+# that, and then setting CMAKE_SIZEOF_VOID_P to *that*.
+#
+# The compile tests include whatever C flags may have been provided
+# to CMake in the CFLAGS and CXXFLAGS environment variables.
+#
+# If you set an architecture flag such as -m32 or -m64 in CFLAGS
+# but *not* in CXXFLAGS, the size for C++ will win, and hilarity
+# will ensue.
+#
+# Make sure CMAKE_C_SIZEOF_DATA_PTR and CMAKE_CXX_SIZEOF_DATA_PTR
+# have the same value, and warn if they don't.
+#
+# Yes, we have to do this even though there is currently *NO* C++
+# code in tcpdump....
+#
+if(NOT "${CMAKE_C_SIZEOF_DATA_PTR}" EQUAL "${CMAKE_CXX_SIZEOF_DATA_PTR}")
+    message(FATAL_ERROR "Architecture flags must be set in both CFLAGS and CXXFLAGS")
+endif()
+
 #
 # For checking if a compiler flag works and adding it if it does.
 #