Wireshark-dev: Re: [Wireshark-dev] CMake for Windows
From: Roland Knall <[email protected]>
Date: Wed, 26 Jun 2013 11:10:51 +0200

As I am somewhat converse in cmake, I can give you a few pointers, if you like.

In general for each package a cmake system should look for, a
Find<PackageName>.cmake file should exist in either one of two places:

- The local directory (in wireshark underneath <src>/cmake/modules/Find....
- Or the global cmake directory <cmake_install_dir>/Modules/Find...

Those packages usually comply to a definition, where you can provide a
searchpath by setting a directory before including the package.

So if you have a CMakeLists.txt with the following context:




then you can set a search path by using:

    SET(ZLIB_INCLUDE_DIRS "c:\\wireshark-win32-libs\\zlib125\\include")
    SET(ZLIB_LIBRARY_DIRS "c:\\wireshark-win32-libs\\zlib125\\bin"
"c:\\wireshark-win32-libs\\zlib125\\lib" )

But setting static routes should be avoided, so better set a relative
path (aka ${PROJECT_BINARY_DIR}/../..) or
using a system variable.

If you have to call a script, you should do this by using either
EXECUTE_PROCESS or better create a CUSTOM_TARGET which you can depend
on, so that the right libraries will allways be downloaded, if they
cannot be found.

Finally, if you include user-editable scripts, they should start with
CMake...... and end in .txt. Something like config.CMake should be
avoided, as it is nmake specific.

kind regards,

On Fri, Jun 21, 2013 at 1:55 AM, Graham Bloice
<[email protected]> wrote:
> As the starter for some planned major improvements|changes to the win32
> build, I'd like to get CMake working for building Wireshark on Windows.
> I know what I'm doing with the nmake builds, and have once built
> successfully on Ubuntu with CMake, but that's about it for my CMake
> knowledge, so I'm looking for support (Joerg?) to do this, so that:
> a) I don't break CMake on other platforms
> b) I actually get CMake working on Windows
> The first issue I ran into was that CMake wasn't able to find all the third
> party libraries we link with, and required very laborious editing of the
> required items in the CMake GUI.
> Currently the third party libs are retrieved by a bash script run via nmake
> (tools\win-setup.sh) that I'm leaving alone for the moment.  That script
> pulls the required libraries from wireshark.org as zip bundles and then
> expands all the bundles into a single "libs" directory, the path to which is
> configured by the user in "config.nmake".
> My current trunk contents of this "libs" directory is shown below:
> AirPcap_Devpack_4_1_0_1622
> c-ares-1.9.1-1-win32ws
> GeoIP-1.4.8-2-win32ws
> gnutls-2.12.18-1.2-win32ws
> gtk2
> kfw-3-2-2-i386-ws-vc6
> libsmi-svn-40773-win32ws
> lua5.1.4
> nasm-2.09.08
> portaudio_v19_2
> upx303w
> user-guide
> WinSparkle-0.3-44-g2c8d9d3-win32ws
> WpdPack
> zlib125
> Most of these directories contain the required items in three
> sub-directories; "bin" for DLL's, "include" for headers and "lib" for .lib
> import libraries used when linking but some don't follow this pattern (blame
> the originating projects) and the gtk2 directory is an enormous bit-bucket
> of all things gnome including glib.
> So, given all the above, how do I get CMake to search the "libs" directory
> for the required items?  I'm not adverse to adding a config.CMake for the
> user to edit as required.  I suspect I'll need to add some custom CMake
> search packages?? to do this on win32.
> Graham
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <[email protected]>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>              mailto:[email protected]?subject=unsubscribe