Building wxWidgets 3.1.0 on CLion (Ubuntu)

我们两清 提交于 2019-12-01 21:59:20

After some experiments here solution. You can just copy it and change some information and ready to build and run.

cmake_minimum_required(VERSION 3.7)
project(Your_Project_Name) //any name for your project

set(CMAKE_CXX_STANDARD 11)

set(wxWidgets_ROOT_DIR </usr/include/wx-3.0-unofficial>) // here I am  giving where to search for wxwidgets library. it can be different for you
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base REQUIRED)
include(${wxWidgets_USE_FILE})

set(SOURCE_FILES main.cpp)
add_executable(FirstC ${SOURCE_FILES})

target_link_libraries(FirstC ${wxWidgets_LIBRARIES})

For more Information read https://wiki.wxwidgets.org/CMake

Edit 1 Here you shouldn't even add some compile and link config (wx-config --cxxflags and wx-config --libs) as it is necessary in NetBeans

Here is example configuration for macOS 10.14.4 (Mojave) and CLion 2019.1 (/usr/local is folder where I installed wxWidgets)

cmake_minimum_required(VERSION 3.14)
project(wx1Test)

set(CMAKE_CXX_STANDARD 14)

set(wxWidgets_ROOT_DIR </usr/local/include/wx-3.1>)
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base  REQUIRED)
include(${wxWidgets_USE_FILE})

set(SOURCE_FILES main.cpp)
add_executable(wx1Test ${SOURCE_FILES})

target_link_libraries(wx1Test ${wxWidgets_LIBRARIES})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!