Hur implementera wxWidgets i CMake?
Jag behöver hjälp med att implementera wxWidgets i CMake.
Jag har skapat ett projekt för CMake i Visual Studio Community.
Nu så ska jag bara få in konfgurationen här.
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
project ("SolderingStation")
# Include sub-projects.
add_subdirectory ("SolderingStation")
Jag har läst denna manual: https://docs.wxwidgets.org/3.2/overview_cmake.html
Enligt den så kan jag göra det mycket enkelt för mig igenom att klistra in detta
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
project ("SolderingStation")
find_package(wxWidgets REQUIRED COMPONENTS net core base)
if(wxWidgets_USE_FILE) # not defined in CONFIG mode
include(${wxWidgets_USE_FILE})
endif()
add_executable(myapp myapp.cpp)
target_link_libraries(myapp ${wxWidgets_LIBRARIES})
# Include sub-projects.
add_subdirectory ("SolderingStation")
Men detta är inte korrekt!
Det fel som jag får är:
Severity Code Description Project File Line Suppression State Details
Error CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS net core base) C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake 230
Så hur ska jag applicera detta?
Jag har kompilerat wxWidgets och alla mina .lib filer finns i följande:
C:\C++\wxWidgets-3.2.6\lib\vc_x64_lib 64-bit
C:\C++\wxWidgets-3.2.6\lib\vc_lib 32-bit
Fundering
Jag tror att CMake ska vara enkelt att konfigurera. Bara klistra in några rader, sedan är det inget mera. Men tydligen så har jag problem.