Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to build wxWidgets program using CMake

📅 2014-Jul-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cmake, cmakelists.txt, wxwidgets ⬩ 📚 Archive

Configuring a project that uses wxWidgets to build on Windows is quite simple. However, on Linux the same task is a bit more involved and requires using the wx-config program.

CMake has support for wxWidgets, but requires knowing the right incantations to build. A minimal CMakeLists.txt for building a wxWidgets program is given below:


cmake_minimum_required(VERSION 2.8)

find_package(wxWidgets COMPONENTS core base REQUIRED)

include( "${wxWidgets_USE_FILE}" )



This includes the core and base wxWidgets libraries. If you use any other wxWidgets modules, like wxGLCanvas for example, then include the relevant modules, like gl in the find_package command.

Tried with: wxWidgets 3.0, CMake and Ubuntu 14.04

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧