The mingw+qt6+cmake+ninja project depends on the library, which, according to the standard, is installed in 'C:\Program Files\somelib'. There is no way to change the installation path
cmake_minimum_required(VERSION 3.16)
project(untitled_qt6 VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
qt_standard_project_setup()
include_directories("C:/Program Files/somelib/include")
find_library(SOMELIB NAMES somelib PATHS "C:/Program Files/somelib/lib" REQUIRED NO_SYSTEM_ENVIRONMENT_PATH)
set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/icon.rc")
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
${app_icon_resource_windows}
)
qt_add_executable(untitled_qt6
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
target_link_libraries(untitled_qt6 PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
${SOMELIB}
)
set_target_properties(untitled_qt6 PROPERTIES WIN32_EXECUTABLE TRUE)
qt_finalize_executable(untitled_qt6)
There is a known error with the transmission of the path
cc1.exe: fatal error: Files/somelib: No such file or directory
which can be solved by passing the path as follows.
windres -I\""C:/Program Files/somelib/include\""
Is there any way to interfere with the build process or solve this problem in another way without changing the path to the library?