Wireshark’s build environment can be configured using CMake on various UNIX-like platforms, including Linux, macOS, and *BSD, and on Windows. CMake is designed to support out-of-tree builds - so much so that in-tree builds do not work properly in all cases. Along with being cross-platform, CMake supports many build tools and environments including traditional make, Ninja, and MSBuild. Our Buildbot runs CMake steps on Ubuntu, Win32, Win64, and macOS. In particular, the macOS and Windows packages are built using CMake.
Building with CMake typically includes creating a build directory and specifying a generator, aka a build tool. For example, to build Wireshark using Ninja in the directory wireshark-ninja you might run the following commands:
# Starting from your Wireshark source directory, create a build directory # alongside it. $ cd .. $ mkdir wireshark-ninja $ cd wireshark-ninja # Assumes your source directory is named "wireshark". $ cmake -G Ninja ../wireshark $ ninja (or cmake --build .)
Using CMake on Windows is described further in Section 2.2.11, “Generate the build files”.
Along with specifying a generator with the
-G flag you can set variables
-D flag. Useful variables and generators include the following:
You can list all build variables (with help) by running
cmake -LH [options]
../<Name_of_WS_source_dir>. This lists the cache of build variables
after the cmake run. To only view the current cache, add option
After running cmake, you can always run
make help to see a list of all possible make targets.
Note that CMake honors user umask for creating directories as of now. You should set
the umask explicitly before running the
The home page of the CMake project: https://cmake.org/
Official documentation: https://cmake.org/documentation/
About CMake in general and why KDE4 uses it: http://lwn.net/Articles/188693/
Introductory tutorial/presentation: http://ait.web.psi.ch/services/linux/hpc/hpc_user_cookbook/tools/cmake/docs/Cmake_VM_2007.pdf
Introductory article in the Linux Journal: http://www.linuxjournal.com/node/6700/print
Useful variables: http://www.cmake.org/Wiki/CMake_Useful_Variables
Frequently Asked Questions: http://www.cmake.org/Wiki/CMake_FAQ