Windows MSYS MinGW Cmake WxWidgets not found Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
fidoriel
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Apr 09, 2020 6:10 pm

Windows MSYS MinGW Cmake WxWidgets not found

Post by fidoriel »

Hello,

today I try the second evening in a row to get WxWidgets on Windows 10 compiling with cmake.

I installed it for MSYS with this command:

Code: Select all

../configure --disable-shared --disable-sys-libs
It worked fine. Manual compiling and linking with wx-config is possible.
Is it may possible to use wx-config with MSYS and cmake too? I tried a slightly modified Linux version, but it did not work.

first version I tried:

Code: Select all

cmake_minimum_required(VERSION 3.0)
set(CMAKE_GNUtoMS_VCVARS 0)

set(CMAKE_BIULD_TYPE Debug)

project(exampleproject)

set(CMAKE_C_COMPILER "C:/MinGW/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/MinGW/bin/g++.exe")

set(wxWidgets_USE_STATIC 1)

SET(wxWidgets_ROOT_DIR "C:/MinGW/msys/1.0/home/user/wxWidgets-3.1.4")
SET(wxWidgets_LIB_DIR "C:/MinGW/msys/1.0/home/user/wxWidgets-3.1.4/win32build/lib")
SET(wxWidgets_LIBRARIES "C:/MinGW/msys/1.0/home/user/wxWidgets-3.1.4/win32build/lib")
SET(wxWidgets_INCLUDE_DIRS "C:/MinGW/msys/1.0/home/user/wxWidgets-3.1.4/include/wx")

set(wxWidgets_wxrc_EXECUTABLE "C:/MinGW/msys/1.0/home/user/wxWidgets-3.1.4/win32build/utils/wxrc.exe")

find_package(wxWidgets COMPONENTS net gl core base)
include(${wxWidgets_USE_FILE})

set(SRC_FILES
    main.cpp
    )

add_executable(${PROJECT_NAME} WIN32 ${SRC_FILES})
target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})
Version 2 I tried:

Code: Select all

cmake_minimum_required(VERSION 3.0)

set(CMAKE_BIULD_TYPE Debug)

project(exampleproject)


set(wxWidgets_ROOT_DIR "/home/user/wxWidgets-3.1.4")
set(wxWidgets_CONFIG_EXECUTABLE "${wxWidgets_ROOT_DIR}/win32build/wx-config")

find_package(wxWidgets COMPONENTS core base adv html xml xrc aui REQUIRED) # xrc needs adv

#if libs are static use --libs --static instead for standard libs.
set(WX_CONFIG_ARGS_LIBS "--libs --static")
set(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`")

set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`")

include("${wxWidgets_USE_FILE}")

if(wxWidgets_FOUND)
	message("wxWidgets found!")
else(wxWidgets_FOUND)
	message("wxWidgets not found!")
endif(wxWidgets_FOUND)

# Define a variable containing a list of source files for the project
set(SRC_FILES
    main.cpp
    )

# Define the build target for the executable
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Link required libraries to the executable
target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})
Neither wx-config nor wxrc.exe worked. The error message is every time the same:

Code: Select all

 Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
  wxWidgets_INCLUDE_DIRS)
I am desperate for this issue. Thank you
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Windows MSYS MinGW Cmake WxWidgets not found

Post by ONEEYEMAN »

Hi,
You already have a working version of the library. What else do you need?
wxWidgets provides everything you need to successfully compile the library and build your own program...

If it works - it works. Don't change anything. Sun will go up on east and go down om west. ;-)

Thank you.
User avatar
conleec
Earned a small fee
Earned a small fee
Posts: 10
Joined: Wed Aug 22, 2018 4:19 pm
Location: Los Angeles
Contact:

Re: Windows MSYS MinGW Cmake WxWidgets not found

Post by conleec »

I successfully built the samples using CLion and CMake a while ago. Some of what I learned may be helpful to you. You can find it here:
viewtopic.php?p=197038#p187276
---------------------------
Chris Conlee
wxWidgets Learner
CLion 2918.2.5 / CMake 3.12
wxWidgets 3.1.1
Post Reply