[CMake] FindwxWidgets can't find wxWidgets installed by MSYS2

Alex Zelid alex at zelid.com
Fri Oct 16 06:12:17 EDT 2015


Hello,

I'm using mingw-w64 installed by MSYS2 (https://msys2.github.io/)

wxWidgets .dlls are installed in C:\msys64\mingw32\bin
libs in C:\msys64\mingw32\lib

My CMakeList.txt:
-------------------------------------------
SET(myapp1_SRCS main.cpp)
add_executable(${PROJECT_NAME} ${myapp1_SRCS})

set(BUILD_SHARED_LIBS 0)

#Set Linker flags
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")

find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
message(STATUS "LibPNG package was found with include dir:
'${PNG_INCLUDE_DIRS}'")
find_package(Threads REQUIRED)
SET(wxWidgets_USE_STATIC ON)
SET(wxWidgets_WXCONFIG_OPTS "--static=yes")
find_package( wxWidgets REQUIRED html adv core base net aui xrc qa richtext)
include(${wxWidgets_USE_FILE})

target_link_libraries(${PROJECT_NAME} ${PNG_LIBRARY}
${CMAKE_THREAD_LIBS_INIT} ${wxWidgets_LIBRARIES})
-------------------------------------------

When I generate "MinGW Makefiles" from windows CMD (not from MSYS2
terminal) CMake finds PNG but doesn't fine wxWidgets:

C:\msys64\home\Alex\workspace\_cmake\wxdemo1\build-mingw32>cmake -G "MinGW
Makefiles" ..\master
-- The C compiler identification is GNU 5.2.0
-- The CXX compiler identification is GNU 5.2.0
-- Check for working C compiler: C:/msys64/mingw32/bin/gcc.exe
-- Check for working C compiler: C:/msys64/mingw32/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/msys64/mingw32/bin/g++.exe
-- Check for working CXX compiler: C:/msys64/mingw32/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: C:/msys64/mingw32/lib/libz.dll.a (found version "1.2.8")
-- Found PNG: C:/msys64/mingw32/lib/libpng.dll.a (found version "1.6.18")
-- LibPNG package was found with include dir:
'C:/msys64/mingw32/include;C:/msys64/mingw32/include'
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
CMake Error at
C:/msys64/mingw32/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148
(message):
  Could NOT find wxWidgets (missing: wxWidgets_FOUND)
Call Stack (most recent call first):

C:/msys64/mingw32/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388
(_FPHSA_FAILURE_MESSAGE)
  C:/msys64/mingw32/share/cmake-3.3/Modules/FindwxWidgets.cmake:871
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  myapp1/CMakeLists.txt:26 (find_package)


-- Configuring incomplete, errors occurred!
See also
"C:/msys64/home/Alex/workspace/_cmake/wxdemo1/build-mingw32/CMakeFiles/CMakeOutput.log".


It happens because wxWidgets are placed in non-standard for mingw version
of wxWidgets path.

I've also tried cmake -DwxWidgets_ROOT_DIR=C:/msys64/mingw32
-DwxWidgets_LIB_DIR=C:/msys64/mingw32/lib -G "MinGW Makefiles" ..\master
it gave the same error

How to make FindwxWidgets work in that case?

Thanks,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151016/cedf2e58/attachment-0001.html>


More information about the CMake mailing list