FIX CMakeLists
This commit is contained in:
parent
99fd3d61ce
commit
fd35c2bf03
@ -1,9 +1,9 @@
|
|||||||
#cmake最低版本
|
#cmake最低版本
|
||||||
cmake_minimum_required(VERSION 3.19)
|
cmake_minimum_required(VERSION 3.19)
|
||||||
|
|
||||||
set(VCPKG_ROOT "F:/SourceCode/vcpkg")
|
SET(VCPKG_ROOT "F:/SourceCode/vcpkg")
|
||||||
set(CMAKE_TOOLCHAIN_FILE "F:/SourceCode/vcpkg/scripts/buildsystems/vcpkg.cmake")
|
SET(CMAKE_TOOLCHAIN_FILE "F:/SourceCode/vcpkg/scripts/buildsystems/vcpkg.cmake")
|
||||||
set(VCPKG_TARGET_TRIPLET "x64-mingw-static")
|
SET(VCPKG_TARGET_TRIPLET "x64-mingw-static")
|
||||||
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc.exe")
|
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc.exe")
|
||||||
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++.exe")
|
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++.exe")
|
||||||
#项目版本
|
#项目版本
|
||||||
@ -29,6 +29,7 @@ SET(CMAKE_CXX_FLAGS"-Wall -Wextra")
|
|||||||
SET(CMAKE_CXX_FLAGS_RELEASE"-O3 -s")
|
SET(CMAKE_CXX_FLAGS_RELEASE"-O3 -s")
|
||||||
SET(CMAKE_BUILD_TYPE "Release")
|
SET(CMAKE_BUILD_TYPE "Release")
|
||||||
|
|
||||||
|
MESSAGE(STATUS ${PROJECT_BINARY_DIR})
|
||||||
MESSAGE(STATUS "----------编译模式 START-------------")
|
MESSAGE(STATUS "----------编译模式 START-------------")
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Debug]")
|
MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Debug]")
|
||||||
@ -37,13 +38,19 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
else()
|
else()
|
||||||
MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Release]")
|
MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Release]")
|
||||||
SET(CMAKE_BUILD_TYPE "Release")
|
SET(CMAKE_BUILD_TYPE "Release")
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/release)
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/release/)
|
||||||
endif()
|
endif()
|
||||||
MESSAGE(STATUS "----------编译模式 END---------------")
|
MESSAGE(STATUS "----------编译模式 END---------------")
|
||||||
|
|
||||||
#设置QT .cmake文件路径
|
#设置QT .cmake文件路径
|
||||||
#自编译QT静态库
|
#自编译QT静态库
|
||||||
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake")
|
SET(QT_STATU "dynamic")
|
||||||
|
|
||||||
|
if(QT_STATU STREQUAL "dynamic")
|
||||||
|
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw_64/lib/cmake")
|
||||||
|
else()
|
||||||
|
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake")
|
||||||
|
endif()
|
||||||
|
|
||||||
SET(JSON ${PROJECT_SOURCE_DIR}/3rdparty/json)
|
SET(JSON ${PROJECT_SOURCE_DIR}/3rdparty/json)
|
||||||
|
|
||||||
@ -102,12 +109,10 @@ endif()
|
|||||||
include_directories(${JSON}/include)
|
include_directories(${JSON}/include)
|
||||||
|
|
||||||
#增加XSteam的cpp
|
#增加XSteam的cpp
|
||||||
FILE(GLOB src "${PROJECT_SOURCE_DIR}/src/*.cpp" "${PROJECT_SOURCE_DIR}/src/*.h")
|
FILE(GLOB src_xsteam "${PROJECT_SOURCE_DIR}/src/*.cpp" "${PROJECT_SOURCE_DIR}/src/*.h")
|
||||||
|
|
||||||
|
SET(PROJECT_SOURCES ${src_xsteam})
|
||||||
|
|
||||||
SET(PROJECT_SOURCES
|
|
||||||
main.cpp
|
|
||||||
${src}
|
|
||||||
)
|
|
||||||
# 设置消息策略为qFatal来禁用qDebug信息
|
# 设置消息策略为qFatal来禁用qDebug信息
|
||||||
LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
||||||
|
|
||||||
@ -153,12 +158,7 @@ target_link_options(${PROJECT_NAME} PUBLIC -Wl,--allow-multiple-definition)
|
|||||||
|
|
||||||
# 打印GCC版本号信息
|
# 打印GCC版本号信息
|
||||||
message(STATUS "G++ version: ${CMAKE_CXX_COMPILER_VERSION}")
|
message(STATUS "G++ version: ${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
# 打印所有CMAKE_开头的变量
|
|
||||||
foreach(var IN LISTS CMAKE_VARIABLES)
|
|
||||||
if(var MATCHES "^CMAKE_")
|
|
||||||
message(STATUS "${var} = ${${var}}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
# 获取Qt版本号
|
# 获取Qt版本号
|
||||||
SET(QT_VERSION_STR "${Qt6_VERSION}")
|
SET(QT_VERSION_STR "${Qt6_VERSION}")
|
||||||
# 打印Qt版本号
|
# 打印Qt版本号
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "src/sui.h"
|
#include "sui.h"
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include "src/xsteam_base_ex.h"
|
#include "xsteam_base_ex.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
Loading…
Reference in New Issue
Block a user