102
|
1 if (${STATIC_BUILD})
|
|
2 SET(GOOGLE_LOG_SOURCES_DIR ${CMAKE_BINARY_DIR}/glog-0.3.2)
|
|
3 DownloadPackage("http://google-glog.googlecode.com/files/glog-0.3.2.tar.gz" "${GOOGLE_LOG_SOURCES_DIR}" "" "")
|
|
4
|
|
5 include_directories(
|
|
6 ${GOOGLE_LOG_SOURCES_DIR}/src
|
|
7 )
|
|
8
|
|
9 if (CMAKE_COMPILER_IS_GNUCXX)
|
|
10 execute_process(
|
|
11 COMMAND patch utilities.cc ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-utilities.diff
|
|
12 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src
|
|
13 )
|
|
14 execute_process(
|
105
|
15 COMMAND patch port.h ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-port-h.diff
|
|
16 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows
|
|
17 )
|
|
18 execute_process(
|
|
19 COMMAND patch port.cc ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-port-cc.diff
|
102
|
20 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows
|
|
21 )
|
|
22 endif()
|
|
23
|
|
24 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
25 configure_file(
|
|
26 ${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.h
|
|
27 ${GOOGLE_LOG_SOURCES_DIR}/src/config.h
|
|
28 COPYONLY)
|
|
29
|
|
30 set(GOOGLE_LOG_SOURCES
|
|
31 ${GOOGLE_LOG_SOURCES_DIR}/src/demangle.cc
|
|
32 ${GOOGLE_LOG_SOURCES_DIR}/src/logging.cc
|
|
33 ${GOOGLE_LOG_SOURCES_DIR}/src/raw_logging.cc
|
|
34 ${GOOGLE_LOG_SOURCES_DIR}/src/signalhandler.cc
|
|
35 ${GOOGLE_LOG_SOURCES_DIR}/src/symbolize.cc
|
|
36 ${GOOGLE_LOG_SOURCES_DIR}/src/utilities.cc
|
|
37 ${GOOGLE_LOG_SOURCES_DIR}/src/vlog_is_on.cc
|
|
38 )
|
|
39
|
|
40 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
41 include_directories(
|
|
42 ${GOOGLE_LOG_SOURCES_DIR}/src/windows
|
|
43 )
|
|
44
|
|
45 set(GOOGLE_LOG_SOURCES
|
105
|
46 ${GOOGLE_LOG_SOURCES_DIR}/src/windows/port.cc
|
102
|
47 ${GOOGLE_LOG_SOURCES_DIR}/src/logging.cc
|
|
48 ${GOOGLE_LOG_SOURCES_DIR}/src/raw_logging.cc
|
|
49 ${GOOGLE_LOG_SOURCES_DIR}/src/utilities.cc
|
|
50 ${GOOGLE_LOG_SOURCES_DIR}/src/vlog_is_on.cc
|
|
51 )
|
|
52
|
|
53 add_definitions(
|
|
54 -DGLOG_NO_ABBREVIATED_SEVERITIES=1
|
|
55 -DNO_FRAME_POINTER=1
|
|
56 -DGOOGLE_GLOG_DLL_DECL=
|
|
57 )
|
|
58 endif()
|
|
59
|
|
60 add_library(GoogleLog STATIC ${GOOGLE_LOG_SOURCES})
|
|
61 link_libraries(GoogleLog)
|
|
62
|
|
63 else()
|
|
64 CHECK_INCLUDE_FILE_CXX(glog/logging.h HAVE_GOOGLE_LOG_H)
|
|
65 if (NOT HAVE_GOOGLE_LOG_H)
|
|
66 message(FATAL_ERROR "Please install the libgoogle-glog-dev package")
|
|
67 endif()
|
|
68
|
|
69 link_libraries(glog)
|
|
70 endif()
|