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
b561c94b
Commit
b561c94b
authored
Mar 26, 2015
by
Sergiu Dotenco
Committed by
Sergiu Dotenco
Jul 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
determine gflags namespace automatically
parent
f9def39a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
1 deletion
+94
-1
CMakeLists.txt
CMakeLists.txt
+4
-0
DetermineGflagsNamespace.cmake
cmake/DetermineGflagsNamespace.cmake
+69
-0
demangle_unittest.cc
src/demangle_unittest.cc
+5
-0
logging_unittest.cc
src/logging_unittest.cc
+1
-0
signalhandler_unittest.cc
src/signalhandler_unittest.cc
+5
-0
symbolize_unittest.cc
src/symbolize_unittest.cc
+5
-0
utilities_unittest.cc
src/utilities_unittest.cc
+5
-1
No files found.
CMakeLists.txt
View file @
b561c94b
...
...
@@ -24,6 +24,8 @@ set (CPACK_PACKAGE_VERSION ${GLOG_VERSION})
option
(
WITH_GFLAGS
"Use gflags"
ON
)
list
(
APPEND CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
include
(
CMakePackageConfigHelpers
)
include
(
CPack
)
include
(
CheckCSourceCompiles
)
...
...
@@ -36,6 +38,7 @@ include (CheckLibraryExists)
include
(
CheckStructHasMember
)
include
(
CheckSymbolExists
)
include
(
CheckTypeSize
)
include
(
DetermineGflagsNamespace
)
set
(
CMAKE_THREAD_PREFER_PTHREAD 1
)
...
...
@@ -44,6 +47,7 @@ if (WITH_GFLAGS)
if
(
gflags_FOUND
)
set
(
HAVE_LIB_GFLAGS 1
)
determine_gflags_namespace
(
gflags_NAMESPACE
)
endif
(
gflags_FOUND
)
endif
(
WITH_GFLAGS
)
...
...
cmake/DetermineGflagsNamespace.cmake
0 → 100755
View file @
b561c94b
macro
(
determine_gflags_namespace VARIABLE
)
if
(
NOT DEFINED
"
${
VARIABLE
}
"
)
if
(
CMAKE_REQUIRED_INCLUDES
)
set
(
CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS
"-DINCLUDE_DIRECTORIES=
${
CMAKE_REQUIRED_INCLUDES
}
"
)
else
()
set
(
CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS
)
endif
()
set
(
MACRO_CHECK_INCLUDE_FILE_FLAGS
${
CMAKE_REQUIRED_FLAGS
}
)
set
(
_NAMESPACES gflags google
)
set
(
_check_code
"
#include <gflags/gflags.h>
int main(int argc, char**argv)
{
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
}
"
)
if
(
NOT CMAKE_REQUIRED_QUIET
)
message
(
STATUS
"Looking for gflags namespace"
)
endif
()
if
(
${
ARGC
}
EQUAL 3
)
set
(
CMAKE_CXX_FLAGS_SAVE
${
CMAKE_CXX_FLAGS
}
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
ARGV2
}
"
)
endif
()
set
(
_check_file
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/CMakeTmp/DetermineGflagsNamespace.cxx
)
foreach
(
_namespace
${
_NAMESPACES
}
)
file
(
WRITE
"
${
_check_file
}
"
"
${
_check_code
}
"
)
try_compile
(
${
VARIABLE
}
"
${
CMAKE_BINARY_DIR
}
"
"
${
_check_file
}
"
COMPILE_DEFINITIONS
"
${
CMAKE_REQUIRED_DEFINITIONS
}
"
-DGFLAGS_NAMESPACE=
${
_namespace
}
LINK_LIBRARIES
"
${
gflags_LIBRARIES
}
"
CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=
"
${
gflags_INCLUDE_DIR
}
"
OUTPUT_VARIABLE OUTPUT
)
if
(
${
VARIABLE
}
)
set
(
${
VARIABLE
}
${
_namespace
}
CACHE INTERNAL
"gflags namespace"
FORCE
)
break
()
else
()
file
(
APPEND
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/CMakeError.log
"Determining the gflags namespace
${
_namespace
}
failed with the following output:
\n
"
"
${
OUTPUT
}
\n\n
"
)
endif
()
endforeach
(
_namespace
)
if
(
${
ARGC
}
EQUAL 3
)
set
(
CMAKE_CXX_FLAGS
${
CMAKE_CXX_FLAGS_SAVE
}
)
endif
()
if
(
${
VARIABLE
}
)
if
(
NOT CMAKE_REQUIRED_QUIET
)
message
(
STATUS
"Looking for gflags namespace -
${${
VARIABLE
}}
"
)
endif
()
file
(
APPEND
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/CMakeOutput.log
"Determining the gflags namespace passed with the following output:
\n
"
"
${
OUTPUT
}
\n\n
"
)
else
()
if
(
NOT CMAKE_REQUIRED_QUIET
)
message
(
STATUS
"Looking for gflags namespace - failed"
)
endif
()
set
(
${
VARIABLE
}
${
_namespace
}
CACHE INTERNAL
"gflags namespace"
)
endif
()
endif
()
endmacro
()
src/demangle_unittest.cc
View file @
b561c94b
...
...
@@ -41,6 +41,11 @@
#include "googletest.h"
#include "config.h"
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
using
namespace
GFLAGS_NAMESPACE
;
#endif
GLOG_DEFINE_bool
(
demangle_filter
,
false
,
"Run demangle_unittest in filter mode"
);
...
...
src/logging_unittest.cc
View file @
b561c94b
...
...
@@ -61,6 +61,7 @@ DECLARE_string(log_backtrace_at); // logging.cc
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
using
namespace
GFLAGS_NAMESPACE
;
#endif
#ifdef HAVE_LIB_GMOCK
...
...
src/signalhandler_unittest.cc
View file @
b561c94b
...
...
@@ -41,6 +41,11 @@
#include <string>
#include "glog/logging.h"
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
using
namespace
gflags
;
#endif
using
namespace
GOOGLE_NAMESPACE
;
void
*
DieInThread
(
void
*
)
{
...
...
src/symbolize_unittest.cc
View file @
b561c94b
...
...
@@ -41,6 +41,11 @@
#include "googletest.h"
#include "config.h"
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
using
namespace
GFLAGS_NAMESPACE
;
#endif
using
namespace
std
;
using
namespace
GOOGLE_NAMESPACE
;
...
...
src/utilities_unittest.cc
View file @
b561c94b
...
...
@@ -28,11 +28,15 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Shinichiro Hamaji
#include "utilities.h"
#include "googletest.h"
#include "glog/logging.h"
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
using
namespace
GFLAGS_NAMESPACE
;
#endif
using
namespace
GOOGLE_NAMESPACE
;
TEST
(
utilities
,
sync_val_compare_and_swap
)
{
...
...
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