diff options
author | Guy Harris <gharris@sonic.net> | 2021-08-08 00:36:42 -0700 |
---|---|---|
committer | Denis Ovsienko <denis@ovsienko.info> | 2021-09-29 15:11:01 +0100 |
commit | 15d7577dcac1fbd8b991f78712c61965aa5f48c0 (patch) | |
tree | c1cb76b3ad3d14bf201c64c803278852b2f308c8 /CMakeLists.txt | |
parent | 9c104117227cdbf35b3bdd691bebfd7423227fc4 (diff) | |
download | tcpdump-15d7577dcac1fbd8b991f78712c61965aa5f48c0.tar.gz |
On Solaris, for 64-bit builds, use the 64-bit pcap-config.
There are two versions of pcap-config supplied on Solaris (or, at least,
on 64-bit Solaris) - a version that has the right --libs output to find
the 32-bit libraries and a version that has the right --libs output to
find the 64-bit libraries.
Try to figure out whether we're doing a 32-bit or 64-bit build (based on
the pointer size) and, for 64-bit builds, run the 64-bit version of
pcap-config.
(cherry picked from commit c39d40a767a1ae36171e5bcbf6f157ff3e80fb6c)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 95da37bc..edd5fd19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,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. # include(CheckCCompilerFlag) |