Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
glog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
glog
Commits
9a43cfb8
Commit
9a43cfb8
authored
Nov 01, 2019
by
Sergiu Deitsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
install unwind find module alongside glog
parent
19570c69
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
20 deletions
+120
-20
CMakeLists.txt
CMakeLists.txt
+98
-15
glog-config.cmake.in
glog-config.cmake.in
+3
-4
glog-modules.cmake.in
glog-modules.cmake.in
+18
-0
stacktrace_windows-inl.h
src/stacktrace_windows-inl.h
+1
-1
No files found.
CMakeLists.txt
View file @
9a43cfb8
...
...
@@ -23,7 +23,16 @@ option (WITH_TLS "Enable Thread Local Storage (TLS) support" ON)
option
(
BUILD_SHARED_LIBS
"Build shared libraries"
OFF
)
option
(
PRINT_UNSYMBOLIZED_STACK_TRACES
"Print raw pc values on symbolization failure"
OFF
)
option
(
WITH_PKGCONFIG
" Enable pkg-config support"
ON
)
option
(
WITH_PKGCONFIG
"Enable pkg-config support"
ON
)
option
(
WITH_UNWIND
"Enable libunwind support"
ON
)
if
(
NOT WITH_UNWIND
)
set
(
CMAKE_DISABLE_FIND_PACKAGE_Unwind ON
)
endif
(
NOT WITH_UNWIND
)
if
(
NOT WITH_THREADS
)
set
(
CMAKE_DISABLE_FIND_PACKAGE_Threads ON
)
endif
(
NOT WITH_THREADS
)
list
(
APPEND CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
...
...
@@ -57,9 +66,13 @@ if (WITH_GFLAGS)
endif
(
gflags_FOUND
)
endif
(
WITH_GFLAGS
)
if
(
WITH_THREADS
)
find_package
(
Threads
)
endif
(
WITH_THREADS
)
find_package
(
Threads
)
find_package
(
Unwind
)
if
(
Unwind_FOUND
)
set
(
HAVE_LIB_UNWIND 1
)
set
(
HAVE_UNWIND_H 1
)
endif
(
Unwind_FOUND
)
check_include_file
(
dlfcn.h HAVE_DLFCN_H
)
check_include_file
(
execinfo.h HAVE_EXECINFO_H
)
...
...
@@ -117,8 +130,6 @@ check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
check_library_exists
(
dbghelp UnDecorateSymbolName
""
HAVE_DBGHELP
)
find_package
(
Unwind
)
check_c_source_compiles
(
"
#include <stdlib.h>
static void foo(void) __attribute__ ((unused));
...
...
@@ -480,16 +491,57 @@ endif (WIN32)
add_compile_options ($<$<AND:$<BOOL:
${
HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS
}
>,$<NOT:$<CXX_COMPILER_ID:GNU>>>:-Wno-unnamed-type-template-args>)
set (_glog_CMake_BINDIR
${
CMAKE_INSTALL_BINDIR
}
)
set (_glog_CMake_INCLUDE_DIR
${
CMAKE_INSTALL_INCLUDEDIR
}
)
set (_glog_CMake_LIBDIR
${
CMAKE_INSTALL_LIBDIR
}
)
set (_glog_CMake_INSTALLDIR
${
_glog_CMake_LIBDIR
}
/cmake/glog)
set (_glog_CMake_DIR glog/cmake)
set (_glog_CMake_DATADIR
${
CMAKE_INSTALL_DATAROOTDIR
}
/
${
_glog_CMake_DIR
}
)
set (_glog_BINARY_CMake_DATADIR
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_glog_CMake_DATADIR
}
)
# Add additional CMake find modules here.
set (_glog_CMake_MODULES)
if (Unwind_FOUND)
# Copy the module only if libunwind is actually used.
list (APPEND _glog_CMake_MODULES
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/FindUnwind.cmake)
endif (Unwind_FOUND)
# Generate file name for each module in the binary directory
foreach (_file
${
_glog_CMake_MODULES
}
)
get_filename_component (_module "
${
_file
}
" NAME)
list (APPEND _glog_BINARY_CMake_MODULES
${
_glog_BINARY_CMake_DATADIR
}
/
${
_module
}
)
endforeach (_file)
if (_glog_CMake_MODULES)
# Copy modules to binary directory during the build
add_custom_command (OUTPUT
${
_glog_BINARY_CMake_MODULES
}
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
_glog_BINARY_CMake_DATADIR
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
_glog_CMake_MODULES
}
${
_glog_BINARY_CMake_DATADIR
}
DEPENDS
${
_glog_CMake_MODULES
}
COMMENT "
Copying find modules...
"
)
endif (_glog_CMake_MODULES)
add_library (glog
${
GLOG_SRCS
}
${
_glog_BINARY_CMake_MODULES
}
)
add_library(glog::glog ALIAS glog)
set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON)
if (Libunwind_FOUND)
target_link_libraries (glog PUBLIC unwind)
endif (Libunwind_FOUND)
if (Unwind_FOUND)
target_link_libraries (glog PUBLIC unwind::unwind)
set (Unwind_DEPENDENCY "
find_dependency
(
Unwind
${
Unwind_VERSION
}
)
")
endif (Unwind_FOUND)
if (HAVE_DBGHELP)
target_link_libraries (glog PUBLIC dbghelp)
...
...
@@ -522,11 +574,6 @@ endif (WIN32)
set_target_properties (glog PROPERTIES PUBLIC_HEADER "
${
GLOG_PUBLIC_H
}
")
set (_glog_CMake_BINDIR
${
CMAKE_INSTALL_BINDIR
}
)
set (_glog_CMake_INCLUDE_DIR
${
CMAKE_INSTALL_INCLUDEDIR
}
)
set (_glog_CMake_LIBDIR
${
CMAKE_INSTALL_LIBDIR
}
)
set (_glog_CMake_INSTALLDIR
${
_glog_CMake_LIBDIR
}
/cmake/glog)
target_include_directories (glog BEFORE PUBLIC
"
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
>
"
"
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/src>
"
...
...
@@ -698,11 +745,47 @@ write_basic_package_version_file (glog-config-version.cmake VERSION
export
(
TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake
)
export
(
PACKAGE glog
)
get_filename_component
(
_PREFIX
"
${
CMAKE_INSTALL_PREFIX
}
"
ABSOLUTE
)
# Directory containing the find modules relative to the config install
# directory.
file
(
RELATIVE_PATH glog_REL_CMake_MODULES
${
_PREFIX
}
/
${
_glog_CMake_INSTALLDIR
}
${
_PREFIX
}
/
${
_glog_CMake_DATADIR
}
/glog-modules.cmake
)
get_filename_component
(
glog_REL_CMake_DATADIR
${
glog_REL_CMake_MODULES
}
DIRECTORY
)
set
(
glog_FULL_CMake_DATADIR
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_glog_CMake_DATADIR
}
)
configure_file
(
glog-modules.cmake.in
${
CMAKE_CURRENT_BINARY_DIR
}
/glog-modules.cmake @ONLY
)
install
(
CODE
"
set (glog_FULL_CMake_DATADIR
\"\\\$
{CMAKE_CURRENT_LIST_DIR}/
${
glog_REL_CMake_DATADIR
}
\"
)
configure_file (
${
CMAKE_CURRENT_SOURCE_DIR
}
/glog-modules.cmake.in
\"
${
CMAKE_CURRENT_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/CMakeTmp/glog-modules.cmake
\"
@ONLY)
file (INSTALL
\"
${
CMAKE_CURRENT_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/CMakeTmp/glog-modules.cmake
\"
DESTINATION
\"\$
{CMAKE_INSTALL_PREFIX}/
${
_glog_CMake_INSTALLDIR
}
\"
)
"
COMPONENT Development
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/glog-config.cmake
${
CMAKE_CURRENT_BINARY_DIR
}
/glog-config-version.cmake
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/FindLibunwind.cmake
DESTINATION
${
_glog_CMake_INSTALLDIR
}
)
# Find modules in share/glog/cmake
install
(
DIRECTORY
${
_glog_BINARY_CMake_DATADIR
}
DESTINATION
${
CMAKE_INSTALL_DATAROOTDIR
}
/glog
COMPONENT Development
FILES_MATCHING PATTERN
"*.cmake"
)
install
(
EXPORT glog-targets NAMESPACE glog:: DESTINATION
${
_glog_CMake_INSTALLDIR
}
)
glog-config.cmake.in
View file @
9a43cfb8
...
...
@@ -5,10 +5,9 @@ endif (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@)
@PACKAGE_INIT@
include (CMakeFindDependencyMacro)
include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake)
@gflags_DEPENDENCY@
@Unwind_DEPENDENCY@
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_dependency (Libunwind)
include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake")
include (${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake)
glog-modules.cmake.in
0 → 100644
View file @
9a43cfb8
cmake_policy (PUSH)
cmake_policy (SET CMP0057 NEW)
if (CMAKE_VERSION VERSION_LESS 3.3)
message (FATAL_ERROR "glog-modules.cmake requires the consumer "
"to use CMake 3.3 (or newer)")
endif (CMAKE_VERSION VERSION_LESS 3.3)
set (glog_MODULE_PATH "@glog_FULL_CMake_DATADIR@")
list (APPEND CMAKE_MODULE_PATH ${glog_MODULE_PATH})
if (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH)
message (FATAL_ERROR "Cannot add '${glog_MODULE_PATH}' to "
"CMAKE_MODULE_PATH. This will cause glog-config.cmake to fail at "
"locating required find modules. Make sure CMAKE_MODULE_PATH is not a cache variable.")
endif (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH)
cmake_policy (POP)
src/stacktrace_windows-inl.h
View file @
9a43cfb8
...
...
@@ -34,7 +34,7 @@
#include "config.h"
#include "port.h"
#include "stacktrace.h"
#include <
DbgH
elp.h>
#include <
dbgh
elp.h>
_START_GOOGLE_NAMESPACE_
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment