mirror of https://github.com/qt/qtbase.git
CMake: Add optional propagation argument to qt_add_win_app_sdk
This propagation is used for including header files and linking to the Windows App SDK library. Pick-to: 6.10 Task-number: QTBUG-124800 Change-Id: Ib5132de3bd673a57f55dda92381315070b6ecb99 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
d022503606
commit
2c6167942a
|
@ -8,6 +8,23 @@ function(qt6_add_win_app_sdk target)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(no_value_options INTERFACE PUBLIC PRIVATE)
|
||||||
|
set(single_value_options "")
|
||||||
|
set(multi_value_options "")
|
||||||
|
cmake_parse_arguments(PARSE_ARGV 1 arg
|
||||||
|
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
|
||||||
|
)
|
||||||
|
if(arg_UNPARSED_ARGUMENTS)
|
||||||
|
message(FATAL_ERROR "Unexpected arguments: ${arg_UNPARSED_ARGUMENTS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(propagation PRIVATE)
|
||||||
|
if(arg_PUBLIC)
|
||||||
|
set(propagation PUBLIC)
|
||||||
|
elseif(arg_INTERFACE)
|
||||||
|
set(propagation INTERFACE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR
|
||||||
CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
|
CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
|
||||||
set(win_app_sdk_arch "arm64")
|
set(win_app_sdk_arch "arm64")
|
||||||
|
@ -87,15 +104,15 @@ function(qt6_add_win_app_sdk target)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(${target} PRIVATE "${win_app_sdk_root}/include")
|
target_include_directories(${target} ${propagation} "${win_app_sdk_root}/include")
|
||||||
target_include_directories(${target}
|
target_include_directories(${target}
|
||||||
PRIVATE "${generated_headers_path}")
|
${propagation} "${generated_headers_path}")
|
||||||
target_link_directories(${target}
|
target_link_directories(${target}
|
||||||
PRIVATE "${win_app_sdk_root}/lib/win10-${win_app_sdk_arch}")
|
${propagation} "${win_app_sdk_root}/lib/win10-${win_app_sdk_arch}")
|
||||||
target_link_directories(${target}
|
target_link_directories(${target}
|
||||||
PRIVATE "${win_app_sdk_root}/runtimes/win-${win_app_sdk_arch}/native")
|
${propagation} "${win_app_sdk_root}/runtimes/win-${win_app_sdk_arch}/native")
|
||||||
target_link_libraries(${target}
|
target_link_libraries(${target}
|
||||||
PRIVATE Microsoft.WindowsAppRuntime.lib Microsoft.WindowsAppRuntime.Bootstrap.lib)
|
${propagation} Microsoft.WindowsAppRuntime.lib Microsoft.WindowsAppRuntime.Bootstrap.lib)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||||
|
|
|
@ -16,7 +16,13 @@
|
||||||
\section1 Synopsis
|
\section1 Synopsis
|
||||||
|
|
||||||
\badcode
|
\badcode
|
||||||
qt_add_win_app_sdk(target)
|
qt_add_win_app_sdk(<TARGET>)
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
Since 6.10:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
qt_add_win_app_sdk(<TARGET> [<PROPAGATION>])
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
\versionlessCMakeCommandsNote qt6_add_win_app_sdk()
|
\versionlessCMakeCommandsNote qt6_add_win_app_sdk()
|
||||||
|
@ -24,7 +30,8 @@ qt_add_win_app_sdk(target)
|
||||||
\section1 Description
|
\section1 Description
|
||||||
|
|
||||||
Adds Windows App SDK include files to the project, and links the necessary
|
Adds Windows App SDK include files to the project, and links the necessary
|
||||||
libraries to the given CMake target. Windows App SDK is provided as a \l{https://learn.microsoft.com/en-us/nuget/what-is-nuget}{NuGet}
|
libraries to the given CMake target. Windows App SDK is provided as
|
||||||
|
a \l{https://learn.microsoft.com/en-us/nuget/what-is-nuget}{NuGet}
|
||||||
package so it can be easily used in managed apps. However, for unmanaged
|
package so it can be easily used in managed apps. However, for unmanaged
|
||||||
C++ applications we need header files.
|
C++ applications we need header files.
|
||||||
The function takes the following steps:
|
The function takes the following steps:
|
||||||
|
@ -34,5 +41,43 @@ The function takes the following steps:
|
||||||
\li Includes those header files and links the library to the given CMake target
|
\li Includes those header files and links the library to the given CMake target
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
|
\section1 Arguments
|
||||||
|
|
||||||
|
\c PROPAGATION
|
||||||
|
|
||||||
|
Specifies the propagation visibility of include directories, link directories, and linked libraries
|
||||||
|
for the target.
|
||||||
|
This argument is passed directly to the following CMake commands:
|
||||||
|
\list 1
|
||||||
|
\li target_include_directories()
|
||||||
|
\li target_link_directories()
|
||||||
|
\li target_link_libraries()
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
It determines how these properties are applied to the target itself and whether they are propagated
|
||||||
|
to other targets that link against it.
|
||||||
|
\section2 Accepted values:
|
||||||
|
\list 1
|
||||||
|
\li PRIVATE:
|
||||||
|
The settings (include directories, link directories, and linked libraries) are applied only
|
||||||
|
to the current target. They are not visible to targets that link against this one.
|
||||||
|
\li PUBLIC:
|
||||||
|
The settings are applied to the current target and are also propagated to any target that
|
||||||
|
links against it. Use this when the dependency is required both for building the target and
|
||||||
|
for its consumers.
|
||||||
|
\li INTERFACE:
|
||||||
|
The settings are not used when building the current target, but are propagated to targets
|
||||||
|
that link against it. This is typically used for header-only libraries or interface targets
|
||||||
|
that expose usage requirements without needing them for their own build.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
\section2 Notes
|
||||||
|
\list 1
|
||||||
|
\li This argument is optional.
|
||||||
|
\li If omitted, the default behavior is equivalent to PRIVATE (or specify your actual default).
|
||||||
|
\li Use the appropriate propagation scope to accurately describe your target’s dependencies
|
||||||
|
and usage requirements.
|
||||||
|
\endlist
|
||||||
|
|
||||||
\warning This command is not supported on non-MSVC platforms.
|
\warning This command is not supported on non-MSVC platforms.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue