Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit 195d416

Browse files
MichaelDarrsergiud
authored andcommitted
Add target existence checks to Unwind find module (#518)
* Add target existence checks to Unwind find module The build systems of projects depending on Glog may call the Unwind find module multiple times. In these cases, the current unwind find module tries to create a duplicate unwind::unwind target, crashing the build. This patch adds an existence check before target creation to fix this issue. Signed-off-by: Michael Darr <mdarr@matician.com> * Alphabetize contributor list * Fix inconsistent CMake style Signed-off-by: Michael Darr <medarr@email.wm.edu>
1 parent 130a3e1 commit 195d416

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Ivan Penkov <ivanpe@google.com>
3434
Jacob Trimble <modmaker@google.com>
3535
Jim Ray <jimray@google.com>
3636
Marco Wang <m.aesophor@gmail.com>
37+
Michael Darr <mdarr@matician.com>
3738
Michael Tanner <michael@tannertaxpro.com>
3839
MiniLight <MiniLightAR@Gmail.com>
3940
Peter Collingbourne <pcc@google.com>

cmake/FindUnwind.cmake

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ find_package_handle_standard_args (Unwind REQUIRED_VARS Unwind_INCLUDE_DIR
6262
Unwind_LIBRARY Unwind_PLATFORM_LIBRARY VERSION_VAR Unwind_VERSION)
6363

6464
if (Unwind_FOUND)
65-
add_library (unwind::unwind INTERFACE IMPORTED)
65+
if (NOT TARGET unwind::unwind)
66+
add_library (unwind::unwind INTERFACE IMPORTED)
6667

67-
set_property (TARGET unwind::unwind PROPERTY
68-
INTERFACE_INCLUDE_DIRECTORIES ${Unwind_INCLUDE_DIR}
69-
)
70-
set_property (TARGET unwind::unwind PROPERTY
71-
INTERFACE_LINK_LIBRARIES ${Unwind_LIBRARY} ${Unwind_PLATFORM_LIBRARY}
72-
)
73-
set_property (TARGET unwind::unwind PROPERTY
74-
IMPORTED_CONFIGURATIONS RELEASE
75-
)
68+
set_property (TARGET unwind::unwind PROPERTY
69+
INTERFACE_INCLUDE_DIRECTORIES ${Unwind_INCLUDE_DIR}
70+
)
71+
set_property (TARGET unwind::unwind PROPERTY
72+
INTERFACE_LINK_LIBRARIES ${Unwind_LIBRARY} ${Unwind_PLATFORM_LIBRARY}
73+
)
74+
set_property (TARGET unwind::unwind PROPERTY
75+
IMPORTED_CONFIGURATIONS RELEASE
76+
)
77+
endif (NOT TARGET unwind::unwind)
7678
endif (Unwind_FOUND)

0 commit comments

Comments
 (0)