OfficeAssistant_Win10/CMakeLists.txt

53 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.25)
project(officeassistant)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
add_compile_definitions(UNICODE)
set(CMAKE_PREFIX_PATH "C:/Qt/Qt5.6.3_msvc/5.6.3/msvc2015")
set(CMAKE_EXE_LINKER_FLAGS "/SAFESEH:NO" )
find_package(Qt5 COMPONENTS
Core
Gui
Widgets
Network
REQUIRED)
add_executable(officeassistant WIN32 main.cpp mainwindow.cpp mainwindow.h mainwindow.ui mainwindowlayout.cpp mainwindowlayout.h mainwindowlayout.ui navbar.cpp navbar.h navbar.ui MyButton.cpp MyButton.h buttonstruct.h globalvariables.h mainscreen.cpp mainscreen.h mainscreen.ui netio.cpp netio.h config.h)
target_link_libraries(officeassistant
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Network
)
if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(DEBUG_SUFFIX)
if (MSVC AND CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_SUFFIX "d")
endif ()
set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
endif ()
endif ()
if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
endif ()
foreach (QT_LIB Core Gui Widgets)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/bin/Qt5${QT_LIB}${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>")
endforeach (QT_LIB)
endif ()