CMake: Clean up the public API a bit

Add some missing versionless functions.
Rename some functions that are not meant to be public API, and their
usages.

Task-number: QTBUG-86827
Change-Id: Ifb66c04cd7598d83fe80c01a92ab2d269ebaf396
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-10-01 10:58:02 +02:00
parent 84485dfad3
commit 081ec14b25
5 changed files with 55 additions and 38 deletions

View File

@ -8,7 +8,7 @@ function(qt_internal_add_resource target resourceName)
qt_parse_all_arguments(arg "qt_add_resource" "" "PREFIX;LANG;BASE" "FILES" ${ARGN})
QT6_PROCESS_RESOURCE(${target} ${resourceName}
_qt_internal_process_resource(${target} ${resourceName}
PREFIX "${arg_PREFIX}"
LANG "${arg_LANG}"
BASE "${arg_BASE}"

View File

@ -13,11 +13,16 @@ function(qt6_android_get_sdk_build_tools_revision out_var)
list(SORT android_build_tools)
list(REVERSE android_build_tools)
list(GET android_build_tools 0 android_build_tools_latest)
set(QT_ANDROID_SDK_BUILD_TOOLS_REVISION ${android_build_tools_latest})
endif()
set(${out_var} "${QT_ANDROID_SDK_BUILD_TOOLS_REVISION}" PARENT_SCOPE)
set(${out_var} "${android_build_tools_latest}" PARENT_SCOPE)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_android_get_sdk_build_tools_revision)
qt6_android_get_sdk_build_tools_revision(${ARGV})
endfunction()
endif()
# Generate the deployment settings json file for a cmake target.
function(qt6_android_generate_deployment_settings target)
# Information extracted from mkspecs/features/android/android_deployment_settings.prf

View File

@ -112,7 +112,7 @@ function(_qt_internal_set_up_test_run_environment testname)
endfunction()
macro(expect_pass _dir)
macro(_qt_internal_test_expect_pass _dir)
cmake_parse_arguments(_ARGS "" "BINARY" "" ${ARGN})
string(REPLACE "(" "_" testname "${_dir}")
string(REPLACE ")" "_" testname "${testname}")
@ -136,7 +136,7 @@ macro(expect_pass _dir)
endif()
endmacro()
macro(expect_fail _dir)
macro(_qt_internal_test_expect_fail _dir)
string(REPLACE "(" "_" testname "${_dir}")
string(REPLACE ")" "_" testname "${testname}")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")
@ -172,7 +172,7 @@ macro(expect_fail _dir)
)
endmacro()
function(test_module_includes)
function(_qt_internal_test_module_includes)
set(all_args ${ARGN})
set(packages_string "")

View File

@ -308,7 +308,7 @@ endif()
function(qt6_add_resources outfiles )
if (TARGET ${outfiles})
cmake_parse_arguments(arg "" "OUTPUT_TARGETS" "" ${ARGN})
qt6_process_resource(${ARGV})
_qt_internal_process_resource(${ARGV})
if (arg_OUTPUT_TARGETS)
set(${arg_OUTPUT_TARGETS} ${${arg_OUTPUT_TARGETS}} PARENT_SCOPE)
endif()
@ -1031,6 +1031,12 @@ END
endif()
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_generate_win32_rc_file)
qt6_generate_win32_rc_file(${ARGV})
endfunction()
endif()
function(__qt_get_relative_resource_path_for_file output_alias file)
get_property(alias SOURCE ${file} PROPERTY QT_RESOURCE_ALIAS)
if (NOT alias)
@ -1073,7 +1079,7 @@ endfunction()
# will be generated. Should you wish to perform additional processing on these
# targets pass a value to the OUTPUT_TARGETS parameter.
#
function(QT6_PROCESS_RESOURCE target resourceName)
function(_qt_internal_process_resource target resourceName)
cmake_parse_arguments(rcc "" "PREFIX;LANG;BASE;OUTPUT_TARGETS" "FILES;OPTIONS" ${ARGN})
@ -1103,7 +1109,7 @@ function(QT6_PROCESS_RESOURCE target resourceName)
if(NOT rcc_PREFIX)
get_target_property(rcc_PREFIX ${target} QT_RESOURCE_PREFIX)
if (NOT rcc_PREFIX)
message(FATAL_ERROR "QT6_PROCESS_RESOURCE() was called without a PREFIX and the target does not provide QT_RESOURCE_PREFIX. Please either add a PREFIX or make the target ${target} provide a default.")
message(FATAL_ERROR "_qt_internal_process_resource() was called without a PREFIX and the target does not provide QT_RESOURCE_PREFIX. Please either add a PREFIX or make the target ${target} provide a default.")
endif()
endif()
@ -1286,10 +1292,16 @@ endif()
# By default Qt6 forces usage of utf8 sources for consumers of Qt.
# Users can opt out of utf8 sources by calling this function with the target name of their
# application or library.
function(qt_disable_utf8_sources target)
function(qt6_disable_utf8_sources target)
set_target_properties("${target}" PROPERTIES QT_NO_UTF8_SOURCE TRUE)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_disable_utf8_sources)
qt6_disable_utf8_sources(${ARGV})
endfunction()
endif()
function(_qt_internal_apply_strict_cpp target)
# Disable C, Obj-C and C++ GNU extensions aka no "-std=gnu++11".
# Similar to mkspecs/features/default_post.prf's CONFIG += strict_cpp.

View File

@ -86,16 +86,16 @@ endforeach()
include("${_Qt6CTestMacros}")
expect_pass(test_umbrella_config)
expect_pass(test_wrap_cpp_and_resources)
_qt_internal_test_expect_pass(test_umbrella_config)
_qt_internal_test_expect_pass(test_wrap_cpp_and_resources)
if (NOT NO_WIDGETS)
expect_pass(test_dependent_modules)
expect_pass("test(needsquoting)dirname")
_qt_internal_test_expect_pass(test_dependent_modules)
_qt_internal_test_expect_pass("test(needsquoting)dirname")
endif()
expect_fail(test_add_resource_options)
expect_fail(test_wrap_cpp_options)
expect_pass(test_platform_defs_include)
expect_pass(test_qtmainwin_library)
_qt_internal_test_expect_fail(test_add_resource_options)
_qt_internal_test_expect_fail(test_wrap_cpp_options)
_qt_internal_test_expect_pass(test_platform_defs_include)
_qt_internal_test_expect_pass(test_qtmainwin_library)
if (CMAKE_GENERATOR STREQUAL Ninja AND UNIX AND NOT WIN32)
make_directory("${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA/build")
@ -118,24 +118,24 @@ if (CMAKE_GENERATOR STREQUAL Ninja AND UNIX AND NOT WIN32)
endif()
if (NOT NO_DBUS)
expect_pass(test_dbus_module)
_qt_internal_test_expect_pass(test_dbus_module)
endif()
expect_pass(test_multiple_find_package)
expect_pass(test_add_resources_delayed_file)
expect_pass(test_add_binary_resources_delayed_file BINARY test_add_binary_resources_delayed_file)
expect_pass(test_private_includes)
expect_pass(test_private_targets)
expect_pass(test_testlib_definitions)
expect_pass(test_json_plugin_includes)
_qt_internal_test_expect_pass(test_multiple_find_package)
_qt_internal_test_expect_pass(test_add_resources_delayed_file)
_qt_internal_test_expect_pass(test_add_binary_resources_delayed_file BINARY test_add_binary_resources_delayed_file)
_qt_internal_test_expect_pass(test_private_includes)
_qt_internal_test_expect_pass(test_private_targets)
_qt_internal_test_expect_pass(test_testlib_definitions)
_qt_internal_test_expect_pass(test_json_plugin_includes)
expect_fail(test_testlib_no_link_gui)
_qt_internal_test_expect_fail(test_testlib_no_link_gui)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_gui/test_testlib_no_link_gui/"
)
if (NOT NO_WIDGETS)
expect_fail(test_testlib_no_link_widgets)
_qt_internal_test_expect_fail(test_testlib_no_link_widgets)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"
@ -170,30 +170,30 @@ if (NOT NO_DBUS)
)
endif()
test_module_includes(
_qt_internal_test_module_includes(
${qt_module_includes}
)
expect_pass(test_concurrent_module)
expect_pass(test_opengl_lib)
_qt_internal_test_expect_pass(test_concurrent_module)
_qt_internal_test_expect_pass(test_opengl_lib)
if (NOT NO_WIDGETS)
expect_pass(test_interface)
_qt_internal_test_expect_pass(test_interface)
endif()
expect_pass(test_interface_link_libraries)
expect_pass(test_moc_macro_target)
_qt_internal_test_expect_pass(test_interface_link_libraries)
_qt_internal_test_expect_pass(test_moc_macro_target)
# The modification of TARGET_OBJECTS needs the following change in cmake
# https://gitlab.kitware.com/cmake/cmake/commit/93c89bc75ceee599ba7c08b8fe1ac5104942054f
# FIXME: Doesn't currently work with namespaced Qt builds QTBUG-85620
# expect_pass(test_add_big_resource)
# _qt_internal_test_expect_pass(test_add_big_resource)
# With earlier CMake versions, this test would simply run moc multiple times and lead to:
# /usr/bin/ld: error: CMakeFiles/mywidget.dir/mywidget_automoc.cpp.o: multiple definition of 'MyWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)'
# /usr/bin/ld: CMakeFiles/mywidget.dir/moc_mywidget.cpp.o: previous definition here
# Reason: SKIP_* properties were added in CMake 3.8 only
expect_pass(test_QTBUG-63422)
_qt_internal_test_expect_pass(test_QTBUG-63422)
# FIXME: Needs porting of the qmake .pro files to create the modules and plugins in Qt6 CMake land.
# expect_pass(test_import_plugins BINARY ${CMAKE_CTEST_COMMAND})
expect_pass(test_versionless_targets)
# _qt_internal_test_expect_pass(test_import_plugins BINARY ${CMAKE_CTEST_COMMAND})
_qt_internal_test_expect_pass(test_versionless_targets)