-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When UNWIND_LIBRARY is used directly as a public dependency then absolute path is stored in cmake config file. This is an issue when glog is used as part of an SDK, which was built somewhere else. When SDK is installed on developer's machine, cmake config contains a full path to non-existent location. The solution is to find libunwind during configure stage and store target name as a dependency, not a full path Signed-off-by: Vyacheslav Yurkov <[email protected]>
- Loading branch information
Showing
3 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# - Try to find libunwind | ||
# Once done this will define | ||
# | ||
# LIBUNWIND_FOUND - system has libunwind | ||
# unwind - cmake target for libunwind | ||
|
||
find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library") | ||
include (CheckIncludeFile) | ||
check_include_file (libunwind.h HAVE_LIBUNWIND_H) | ||
check_include_file (unwind.h HAVE_UNWIND_H) | ||
|
||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") | ||
set(LIBUNWIND_ARCH "arm") | ||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR | ||
CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR | ||
set(LIBUNWIND_ARCH "x86_64") | ||
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") | ||
set(LIBUNWIND_ARCH "x86") | ||
endif() | ||
|
||
find_library (UNWIND_LIBRARY_PLATFORM NAMES "unwind-${LIBUNWIND_ARCH}" DOC "unwind library platform") | ||
if (UNWIND_LIBRARY_PLATFORM) | ||
set(HAVE_LIB_UNWIND "1") | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
# handle the QUIETLY and REQUIRED arguments and set Libunwind_FOUND to TRUE | ||
# if all listed variables are TRUE | ||
find_package_handle_standard_args(Libunwind DEFAULT_MSG | ||
UNWIND_LIBRARY HAVE_LIBUNWIND_H HAVE_UNWIND_H HAVE_LIB_UNWIND) | ||
|
||
mark_as_advanced (UNWIND_LIBRARY UNWIND_LIBRARY_PLATFORM) | ||
|
||
add_library(unwind INTERFACE IMPORTED) | ||
set_target_properties(unwind PROPERTIES | ||
INTERFACE_LINK_LIBRARIES "${UNWIND_LIBRARY};${UNWIND_LIBRARY_PLATFORM}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters