OneLevelXmlOpr/CMakeLists.txt

74 lines
2.1 KiB
CMake
Raw Normal View History

2025-01-17 10:44:17 +08:00
cmake_minimum_required(VERSION 3.16)
2024-05-15 08:34:54 +08:00
project(OneLevelXmlOpr VERSION 0.1 LANGUAGES CXX)
# 获取环境变量 HOME
if (UNIX)
set(USER_HOME $ENV{HOME})
else()
set(USER_HOME "C:/Qt")
endif()
2024-08-08 17:05:57 +08:00
# 打印用户目录
message(STATUS "User home directory: ${USER_HOME}")
2024-05-20 23:36:44 +08:00
set(CMAKE_PREFIX_PATH
2024-08-27 20:15:41 +08:00
${CMAKE_PREFIX_PATH}
"${USER_HOME}/Qt5.14.2/5.14.2/gcc_64/"
"${USER_HOME}/Qt5.14.2/5.14.2/msvc2017_64/"
"D:/Qt/Qt5.14.2/5.14.2/msvc2017_64/"
"C:/Qt/6.7.2"
2024-09-16 08:32:20 +08:00
"/opt/homebrew/Cellar/qt/6.7.0_2/"
2024-05-20 23:36:44 +08:00
)
2024-05-15 08:34:54 +08:00
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)
include_directories(3rd)
include_directories(src)
include_directories(form)
2024-05-15 08:34:54 +08:00
set(PROJECT_SOURCES
main.cpp
MainWidget.cpp
MainWidget.h
MainWidget.ui 3rd/tinyxml2.cpp
src/xml_opr.h src/xml_opr.cpp
2024-05-29 10:06:28 +08:00
src/config.h src/config.cpp public_def.cpp resource.qrc public_def.h
resource/ico.rc src/attribute_edit.ui src/attribute_edit.h
2024-05-16 08:48:12 +08:00
src/attribute_edit.cpp flatgray.qrc
src/data_edit.h src/data_edit.cpp src/data_edit.ui
src/QCustomQLineEdit.h src/QCustomQLineEdit.cpp
form/qformatset.h form/qformatset.cpp form/qformatset.ui
2024-05-15 08:34:54 +08:00
)
if (MSVC)
# if(${QT_VERSION_MAJOR} LESS 6)
# add_compile_options(/source-charset:utf-8)
# endif()
add_compile_options(/utf-8)
2024-05-28 09:17:23 +08:00
add_compile_options(/EHsc)
add_compile_options(/wd4267)
add_compile_options(-D_CRT_SECURE_NO_WARNINGS)
2024-05-15 08:34:54 +08:00
endif()
add_executable(OneLevelXmlOpr ${PROJECT_SOURCES}
conf_setting.h conf_setting.cpp conf_setting.ui
src/history.h src/history.cpp
src/uhistory.h src/uhistory.cpp src/uhistory.ui)
2024-05-15 08:34:54 +08:00
target_link_libraries(OneLevelXmlOpr PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
set_target_properties(OneLevelXmlOpr PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)