forked from github_mirror/framelesshelper
cmake: minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
cb88b602fe
commit
f956c1c002
|
@ -47,10 +47,6 @@ target_link_libraries(Dialog PRIVATE
|
||||||
FramelessHelper::Widgets
|
FramelessHelper::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(Dialog PRIVATE
|
|
||||||
QT_NO_KEYWORDS
|
|
||||||
)
|
|
||||||
|
|
||||||
include(../../src/core/cmakehelper.cmake)
|
include(../../src/core/cmakehelper.cmake)
|
||||||
setup_gui_app(Dialog)
|
setup_gui_app(Dialog)
|
||||||
setup_compile_params(Dialog)
|
setup_compile_params(Dialog)
|
||||||
|
|
|
@ -48,10 +48,6 @@ target_link_libraries(MainWindow PRIVATE
|
||||||
FramelessHelper::Widgets
|
FramelessHelper::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(MainWindow PRIVATE
|
|
||||||
QT_NO_KEYWORDS
|
|
||||||
)
|
|
||||||
|
|
||||||
include(../../src/core/cmakehelper.cmake)
|
include(../../src/core/cmakehelper.cmake)
|
||||||
setup_gui_app(MainWindow)
|
setup_gui_app(MainWindow)
|
||||||
setup_compile_params(MainWindow)
|
setup_compile_params(MainWindow)
|
||||||
|
|
|
@ -67,10 +67,6 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(OpenGLWidget PRIVATE
|
|
||||||
QT_NO_KEYWORDS
|
|
||||||
)
|
|
||||||
|
|
||||||
include(../../src/core/cmakehelper.cmake)
|
include(../../src/core/cmakehelper.cmake)
|
||||||
setup_gui_app(OpenGLWidget)
|
setup_gui_app(OpenGLWidget)
|
||||||
setup_compile_params(OpenGLWidget)
|
setup_compile_params(OpenGLWidget)
|
||||||
|
|
|
@ -82,7 +82,6 @@ target_link_libraries(Quick PRIVATE
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(Quick PRIVATE
|
target_compile_definitions(Quick PRIVATE
|
||||||
QT_NO_KEYWORDS
|
|
||||||
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
|
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,6 @@ target_link_libraries(Widget PRIVATE
|
||||||
FramelessHelper::Widgets
|
FramelessHelper::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(Widget PRIVATE
|
|
||||||
QT_NO_KEYWORDS
|
|
||||||
)
|
|
||||||
|
|
||||||
include(../../src/core/cmakehelper.cmake)
|
include(../../src/core/cmakehelper.cmake)
|
||||||
setup_gui_app(Widget)
|
setup_gui_app(Widget)
|
||||||
setup_compile_params(Widget)
|
setup_compile_params(Widget)
|
||||||
|
|
|
@ -165,7 +165,6 @@ if(FRAMELESSHELPER_NO_PRIVATE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${SUB_PROJ_NAME} PRIVATE
|
target_compile_definitions(${SUB_PROJ_NAME} PRIVATE
|
||||||
QT_NO_KEYWORDS
|
|
||||||
FRAMELESSHELPER_CORE_LIBRARY
|
FRAMELESSHELPER_CORE_LIBRARY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,26 +28,33 @@ function(setup_compile_params arg_target)
|
||||||
QT_NO_CAST_FROM_ASCII
|
QT_NO_CAST_FROM_ASCII
|
||||||
QT_NO_CAST_FROM_BYTEARRAY
|
QT_NO_CAST_FROM_BYTEARRAY
|
||||||
QT_NO_URL_CAST_FROM_STRING
|
QT_NO_URL_CAST_FROM_STRING
|
||||||
#QT_NO_KEYWORDS # Some QtQuick private headers still use the traditional Qt keywords. Fixed by me since 6.4.
|
|
||||||
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
|
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
|
||||||
QT_NO_FOREACH
|
QT_NO_FOREACH
|
||||||
#QT_TYPESAFE_FLAGS # QtQuick private headers prevent us from enabling this flag.
|
#QT_TYPESAFE_FLAGS # QtQuick private headers prevent us from enabling this flag.
|
||||||
QT_USE_QSTRINGBUILDER
|
QT_USE_QSTRINGBUILDER
|
||||||
QT_USE_FAST_OPERATOR_PLUS
|
QT_USE_FAST_OPERATOR_PLUS
|
||||||
#QT_STRICT_ITERATORS # Need Qt itself also compile with this flag enabled.
|
|
||||||
QT_DEPRECATED_WARNINGS # Have no effect since 6.0
|
QT_DEPRECATED_WARNINGS # Have no effect since 6.0
|
||||||
QT_DEPRECATED_WARNINGS_SINCE=0x070000
|
QT_DEPRECATED_WARNINGS_SINCE=0x070000
|
||||||
QT_WARN_DEPRECATED_UP_TO=0x070000 # Since 6.5
|
QT_WARN_DEPRECATED_UP_TO=0x070000 # Since 6.5
|
||||||
QT_DISABLE_DEPRECATED_BEFORE=0x070000
|
QT_DISABLE_DEPRECATED_BEFORE=0x070000
|
||||||
QT_DISABLE_DEPRECATED_UP_TO=0x070000 # Since 6.5
|
QT_DISABLE_DEPRECATED_UP_TO=0x070000 # Since 6.5
|
||||||
)
|
)
|
||||||
if(WIN32) # Needed by both MSVC and MinGW
|
if(NOT DEFINED __DONT_DISABLE_QT_KEYWORDS OR NOT __DONT_DISABLE_QT_KEYWORDS)
|
||||||
|
target_compile_definitions(${arg_target} PRIVATE
|
||||||
|
QT_NO_KEYWORDS # Some QtQuick private headers still use the traditional Qt keywords.
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(WIN32) # Needed by both MSVC and MinGW, otherwise some APIs we need will be invisible.
|
||||||
set(_WIN32_WINNT_WIN10 0x0A00)
|
set(_WIN32_WINNT_WIN10 0x0A00)
|
||||||
set(NTDDI_WIN10_NI 0x0A00000C)
|
set(NTDDI_WIN10_NI 0x0A00000C)
|
||||||
target_compile_definitions(${arg_target} PRIVATE
|
target_compile_definitions(${arg_target} PRIVATE
|
||||||
WINVER=${_WIN32_WINNT_WIN10} _WIN32_WINNT=${_WIN32_WINNT_WIN10}
|
WINVER=${_WIN32_WINNT_WIN10} _WIN32_WINNT=${_WIN32_WINNT_WIN10}
|
||||||
_WIN32_IE=${_WIN32_WINNT_WIN10} NTDDI_VERSION=${NTDDI_WIN10_NI}
|
_WIN32_IE=${_WIN32_WINNT_WIN10} NTDDI_VERSION=${NTDDI_WIN10_NI}
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(${arg_target} PRIVATE
|
||||||
|
QT_STRICT_ITERATORS # On Windows we need to re-compile Qt with this flag enabled, so only enable it on non-Windows platforms.
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_definitions(${arg_target} PRIVATE
|
target_compile_definitions(${arg_target} PRIVATE
|
||||||
|
@ -182,9 +189,9 @@ function(setup_package_export arg_target arg_path arg_public arg_alias arg_priva
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS ${__targets}
|
install(TARGETS ${__targets}
|
||||||
EXPORT ${arg_target}Targets
|
EXPORT ${arg_target}Targets
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${arg_path}"
|
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${arg_path}"
|
||||||
)
|
)
|
||||||
export(EXPORT ${arg_target}Targets
|
export(EXPORT ${arg_target}Targets
|
||||||
|
@ -197,18 +204,20 @@ function(setup_package_export arg_target arg_path arg_public arg_alias arg_priva
|
||||||
install(EXPORT ${arg_target}Targets
|
install(EXPORT ${arg_target}Targets
|
||||||
FILE ${arg_target}Targets.cmake
|
FILE ${arg_target}Targets.cmake
|
||||||
NAMESPACE ${PROJECT_NAME}::
|
NAMESPACE ${PROJECT_NAME}::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(deploy_qt_runtime arg_target)
|
function(deploy_qt_runtime arg_target)
|
||||||
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Core)
|
if(NOT (DEFINED Qt5_FOUND OR DEFINED Qt6_FOUND))
|
||||||
|
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Core)
|
||||||
|
endif()
|
||||||
if(NOT (Qt5_FOUND OR Qt6_FOUND))
|
if(NOT (Qt5_FOUND OR Qt6_FOUND))
|
||||||
message("You need to install the QtCore module first to be able to deploy the Qt libraries.")
|
message("You need to install the QtCore module first to be able to deploy the Qt libraries.")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
|
||||||
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
|
if(NOT DEFINED QT_QMAKE_EXECUTABLE) # QT_QMAKE_EXECUTABLE is usually defined by QtCreator.
|
||||||
get_target_property(QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
|
get_target_property(QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
|
||||||
endif()
|
endif()
|
||||||
if(NOT EXISTS "${QT_QMAKE_EXECUTABLE}")
|
if(NOT EXISTS "${QT_QMAKE_EXECUTABLE}")
|
||||||
|
@ -286,9 +295,9 @@ function(deploy_qt_runtime arg_target)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(TARGETS ${arg_target}
|
install(TARGETS ${arg_target}
|
||||||
BUNDLE DESTINATION .
|
BUNDLE DESTINATION .
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
)
|
)
|
||||||
if(${QT_VERSION} VERSION_GREATER_EQUAL "6.3")
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
set(__deploy_script)
|
set(__deploy_script)
|
||||||
if(${__is_quick_app})
|
if(${__is_quick_app})
|
||||||
qt_generate_deploy_qml_app_script(
|
qt_generate_deploy_qml_app_script(
|
||||||
|
@ -316,7 +325,9 @@ function(setup_translations arg_target)
|
||||||
# really can't use them until Qt6 (the functions have been completely
|
# really can't use them until Qt6 (the functions have been completely
|
||||||
# re-written in Qt6 and according to my experiments they work reliably
|
# re-written in Qt6 and according to my experiments they work reliably
|
||||||
# now finally).
|
# now finally).
|
||||||
find_package(Qt6 QUIET COMPONENTS LinguistTools)
|
if(NOT DEFINED Qt6LinguistTools_FOUND)
|
||||||
|
find_package(Qt6 QUIET COMPONENTS LinguistTools)
|
||||||
|
endif()
|
||||||
if(NOT Qt6LinguistTools_FOUND)
|
if(NOT Qt6LinguistTools_FOUND)
|
||||||
message("You need to install the Qt Linguist Tools first to be able to create translations.")
|
message("You need to install the Qt Linguist Tools first to be able to create translations.")
|
||||||
return()
|
return()
|
||||||
|
|
|
@ -201,6 +201,8 @@ target_include_directories(${SUB_PROJ_NAME} PUBLIC
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${SUB_PROJ_PATH}/private>"
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${SUB_PROJ_PATH}/private>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(__DONT_DISABLE_QT_KEYWORDS ON)
|
||||||
|
|
||||||
include(../core/cmakehelper.cmake)
|
include(../core/cmakehelper.cmake)
|
||||||
setup_compile_params(${SUB_PROJ_NAME})
|
setup_compile_params(${SUB_PROJ_NAME})
|
||||||
setup_package_export(${SUB_PROJ_NAME} ${SUB_PROJ_PATH} "${PUBLIC_HEADERS}" "${PUBLIC_HEADERS_ALIAS}" "${PRIVATE_HEADERS}")
|
setup_package_export(${SUB_PROJ_NAME} ${SUB_PROJ_PATH} "${PUBLIC_HEADERS}" "${PUBLIC_HEADERS_ALIAS}" "${PRIVATE_HEADERS}")
|
||||||
|
|
|
@ -114,7 +114,6 @@ if(FRAMELESSHELPER_NO_PRIVATE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${SUB_PROJ_NAME} PRIVATE
|
target_compile_definitions(${SUB_PROJ_NAME} PRIVATE
|
||||||
QT_NO_KEYWORDS
|
|
||||||
FRAMELESSHELPER_WIDGETS_LIBRARY
|
FRAMELESSHELPER_WIDGETS_LIBRARY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue