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
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})
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})
Code: Select all
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)