mirror of https://github.com/microsoft/vcpkg.git
[cppwinrt] Guard `add_library` to avoid "another target with the same name already exists" CMake error (#49767)
Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
parent
4cf671c303
commit
8e6be0084f
|
|
@ -1,24 +1,15 @@
|
|||
get_filename_component(_cppwinrt_root "${CMAKE_CURRENT_LIST_DIR}" PATH)
|
||||
get_filename_component(_cppwinrt_root "${_cppwinrt_root}" PATH)
|
||||
|
||||
set(_cppwinrt_exe "${_cppwinrt_root}/@tool_path@")
|
||||
if (EXISTS "${_cppwinrt_exe}")
|
||||
|
||||
add_library(Microsoft::CppWinRT INTERFACE IMPORTED)
|
||||
set_target_properties(Microsoft::CppWinRT PROPERTIES
|
||||
INTERFACE_COMPILE_FEATURES cxx_std_17
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_cppwinrt_root}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${_cppwinrt_root}/lib/@lib_name@"
|
||||
)
|
||||
|
||||
set(cppwinrt_FOUND TRUE)
|
||||
set(CPPWINRT_TOOL ${_cppwinrt_exe})
|
||||
|
||||
else()
|
||||
|
||||
set(cppwinrt_FOUND FALSE)
|
||||
|
||||
if (NOT TARGET Microsoft::CppWinRT)
|
||||
add_library(Microsoft::CppWinRT INTERFACE IMPORTED)
|
||||
set_target_properties(Microsoft::CppWinRT PROPERTIES
|
||||
INTERFACE_COMPILE_FEATURES cxx_std_17
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_cppwinrt_root}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${_cppwinrt_root}/lib/@lib_name@"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CPPWINRT_TOOL "${_cppwinrt_root}/@tool_path@")
|
||||
|
||||
unset(_cppwinrt_root)
|
||||
unset(_cppwinrt_exe)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "cppwinrt",
|
||||
"version": "2.0.250303.1",
|
||||
"port-version": 1,
|
||||
"description": "C++/WinRT is a standard C++ language projection for the Windows Runtime.",
|
||||
"homepage": "https://github.com/microsoft/cppwinrt",
|
||||
"documentation": "https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/",
|
||||
|
|
|
|||
|
|
@ -2134,7 +2134,7 @@
|
|||
},
|
||||
"cppwinrt": {
|
||||
"baseline": "2.0.250303.1",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"cppxaml": {
|
||||
"baseline": "0.0.16",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "756cf03e3e64f2c511996cc06e6b08378e4e0c25",
|
||||
"version": "2.0.250303.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "2b7e34cd0c66a4a4645fd872a27972448f69e134",
|
||||
"version": "2.0.250303.1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue