warning un-recognized parameters

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2023-01-30 17:34:53 +08:00
parent c57780f33f
commit dadfe4f1d9
1 changed files with 27 additions and 0 deletions

View File

@ -28,6 +28,9 @@ function(setup_project)
message(AUTHOR_WARNING "setup_project: You need to specify at least one language for this function!") message(AUTHOR_WARNING "setup_project: You need to specify at least one language for this function!")
return() return()
endif() endif()
if(PROJ_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "setup_project: Unrecognized arguments: ${PROJ_ARGS_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED CMAKE_BUILD_TYPE) if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release PARENT_SCOPE) set(CMAKE_BUILD_TYPE Release PARENT_SCOPE)
endif() endif()
@ -113,6 +116,9 @@ function(get_commit_hash)
message(AUTHOR_WARNING "get_commit_hash: You need to specify a result variable for this function!") message(AUTHOR_WARNING "get_commit_hash: You need to specify a result variable for this function!")
return() return()
endif() endif()
if(GIT_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "get_commit_hash: Unrecognized arguments: ${GIT_ARGS_UNPARSED_ARGUMENTS}")
endif()
set(__hash) set(__hash)
# We do not want to use git command here because we don't want to make git a build-time dependency. # We do not want to use git command here because we don't want to make git a build-time dependency.
if(EXISTS "${PROJECT_SOURCE_DIR}/.git/HEAD") if(EXISTS "${PROJECT_SOURCE_DIR}/.git/HEAD")
@ -140,6 +146,9 @@ function(setup_qt_stuff)
message(AUTHOR_WARNING "setup_qt_stuff: You need to specify at least one target for this function!") message(AUTHOR_WARNING "setup_qt_stuff: You need to specify at least one target for this function!")
return() return()
endif() endif()
if(QT_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "setup_qt_stuff: Unrecognized arguments: ${QT_ARGS_UNPARSED_ARGUMENTS}")
endif()
foreach(__target ${QT_ARGS_TARGETS}) foreach(__target ${QT_ARGS_TARGETS})
target_compile_definitions(${__target} PRIVATE target_compile_definitions(${__target} PRIVATE
QT_NO_CAST_TO_ASCII QT_NO_CAST_TO_ASCII
@ -182,6 +191,9 @@ function(setup_compile_params)
message(AUTHOR_WARNING "setup_compile_params: You need to specify at least one target for this function!") message(AUTHOR_WARNING "setup_compile_params: You need to specify at least one target for this function!")
return() return()
endif() endif()
if(COM_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "setup_compile_params: Unrecognized arguments: ${COM_ARGS_UNPARSED_ARGUMENTS}")
endif()
foreach(__target ${COM_ARGS_TARGETS}) foreach(__target ${COM_ARGS_TARGETS})
# Needed by both MSVC and MinGW, otherwise some APIs we need will not be available. # Needed by both MSVC and MinGW, otherwise some APIs we need will not be available.
if(WIN32) if(WIN32)
@ -330,6 +342,9 @@ function(setup_gui_app)
message(AUTHOR_WARNING "setup_gui_app: You need to specify at least one target for this function!") message(AUTHOR_WARNING "setup_gui_app: You need to specify at least one target for this function!")
return() return()
endif() endif()
if(GUI_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "setup_gui_app: Unrecognized arguments: ${GUI_ARGS_UNPARSED_ARGUMENTS}")
endif()
foreach(__target ${GUI_ARGS_TARGETS}) foreach(__target ${GUI_ARGS_TARGETS})
set_target_properties(${__target} PROPERTIES set_target_properties(${__target} PROPERTIES
WIN32_EXECUTABLE TRUE WIN32_EXECUTABLE TRUE
@ -363,6 +378,9 @@ function(prepare_package_export)
message(AUTHOR_WARNING "prepare_package_export: You need to specify the package version for this function!") message(AUTHOR_WARNING "prepare_package_export: You need to specify the package version for this function!")
return() return()
endif() endif()
if(PKG_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "prepare_package_export: Unrecognized arguments: ${PKG_ARGS_UNPARSED_ARGUMENTS}")
endif()
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
include(GNUInstallDirs) include(GNUInstallDirs)
write_basic_package_version_file( write_basic_package_version_file(
@ -400,6 +418,9 @@ function(setup_package_export)
message(AUTHOR_WARNING "setup_package_export: You need to specify a package name for this function!") message(AUTHOR_WARNING "setup_package_export: You need to specify a package name for this function!")
return() return()
endif() endif()
if(PKG_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "setup_package_export: Unrecognized arguments: ${PKG_ARGS_UNPARSED_ARGUMENTS}")
endif()
include(GNUInstallDirs) include(GNUInstallDirs)
set(__targets ${PKG_ARGS_TARGET}) set(__targets ${PKG_ARGS_TARGET})
# Ugly hack to workaround a CMake configure error. # Ugly hack to workaround a CMake configure error.
@ -451,6 +472,9 @@ function(deploy_qt_runtime)
message(AUTHOR_WARNING "deploy_qt_runtime: You need to specify a target for this function!") message(AUTHOR_WARNING "deploy_qt_runtime: You need to specify a target for this function!")
return() return()
endif() endif()
if(DEPLOY_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "deploy_qt_runtime: Unrecognized arguments: ${DEPLOY_ARGS_UNPARSED_ARGUMENTS}")
endif()
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Core) find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Core)
if(NOT (Qt5_FOUND OR Qt6_FOUND)) if(NOT (Qt5_FOUND OR Qt6_FOUND))
message(AUTHOR_WARNING "deploy_qt_runtime: You need to install the QtCore module first to be able to deploy the Qt libraries.") message(AUTHOR_WARNING "deploy_qt_runtime: You need to install the QtCore module first to be able to deploy the Qt libraries.")
@ -593,6 +617,9 @@ function(setup_translations)
message(AUTHOR_WARNING "setup_translations: You need to specify at least one locale for this function!") message(AUTHOR_WARNING "setup_translations: You need to specify at least one locale for this function!")
return() return()
endif() endif()
if(TRANSLATION_ARGS_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "setup_translations: Unrecognized arguments: ${TRANSLATION_ARGS_UNPARSED_ARGUMENTS}")
endif()
# Qt5's CMake functions to create translations lack many features # Qt5's CMake functions to create translations lack many features
# we need and what's worse, they also have a severe bug which will # we need and what's worse, they also have a severe bug which will
# wipe out our .ts files' contents every time we call them, so we # wipe out our .ts files' contents every time we call them, so we