comparison Resources/CMake/GoogleLogConfiguration.cmake @ 1537:fbf763bb1fa3

error detection in patches
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Aug 2015 15:25:38 +0200
parents 23083810d543
children d2bccd57795e
comparison
equal deleted inserted replaced
1536:1b03676d68c2 1537:fbf763bb1fa3
1 if (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_LOG) 1 if (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_LOG)
2 SET(GOOGLE_LOG_SOURCES_DIR ${CMAKE_BINARY_DIR}/glog-0.3.2) 2 SET(GOOGLE_LOG_SOURCES_DIR ${CMAKE_BINARY_DIR}/glog-0.3.2)
3 DownloadPackage( 3 SET(GOOGLE_LOG_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/glog-0.3.2.tar.gz")
4 "897fbff90d91ea2b6d6e78c8cea641cc" 4 SET(GOOGLE_LOG_MD5 "897fbff90d91ea2b6d6e78c8cea641cc")
5 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/glog-0.3.2.tar.gz"
6 "${GOOGLE_LOG_SOURCES_DIR}")
7 5
6 if (IS_DIRECTORY "${GOOGLE_LOG_SOURCES_DIR}")
7 set(FirstRun OFF)
8 else()
9 set(FirstRun ON)
10 endif()
11
12 DownloadPackage(${GOOGLE_LOG_MD5} ${GOOGLE_LOG_URL} "${GOOGLE_LOG_SOURCES_DIR}")
8 13
9 # Glog 0.3.3 fails to build with old versions of MinGW, such as the 14 # Glog 0.3.3 fails to build with old versions of MinGW, such as the
10 # one installed on our Continuous Integration Server that runs 15 # one installed on our Continuous Integration Server that runs
11 # Debian Squeeze. We thus stick to Glog 0.3.2 for the time being. 16 # Debian Squeeze. We thus stick to Glog 0.3.2 for the time being.
12 17
64 ) 69 )
65 70
66 if (CMAKE_COMPILER_IS_GNUCXX) 71 if (CMAKE_COMPILER_IS_GNUCXX)
67 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") 72 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
68 execute_process( 73 execute_process(
69 COMMAND patch -N utilities.cc ${ORTHANC_ROOT}/Resources/Patches/glog-utilities-lsb.diff 74 COMMAND ${PATCH_EXECUTABLE} -N utilities.cc ${ORTHANC_ROOT}/Resources/Patches/glog-utilities-lsb.diff
70 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src 75 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src
76 RESULT_VARIABLE Failure
71 ) 77 )
72 else() 78 else()
73 execute_process( 79 execute_process(
74 COMMAND patch -N utilities.cc ${ORTHANC_ROOT}/Resources/Patches/glog-utilities.diff 80 COMMAND ${PATCH_EXECUTABLE} -N utilities.cc ${ORTHANC_ROOT}/Resources/Patches/glog-utilities.diff
75 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src 81 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src
82 RESULT_VARIABLE Failure
76 ) 83 )
84 endif()
85
86 if (Failure AND FirstRun)
87 message(FATAL_ERROR "Error while patching a file")
77 endif() 88 endif()
78 89
79 # Patches for MinGW 90 # Patches for MinGW
80 execute_process( 91 execute_process(
81 #COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h.diff 92 #COMMAND ${PATCH_EXECUTABLE} -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h.diff
82 COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h-v2.diff 93 COMMAND ${PATCH_EXECUTABLE} -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h-v2.diff
83 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows 94 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows
95 RESULT_VARIABLE Failure
84 ) 96 )
97
98 if (Failure AND FirstRun)
99 message(FATAL_ERROR "Error while patching a file")
100 endif()
101
85 execute_process( 102 execute_process(
86 COMMAND patch -N port.cc ${ORTHANC_ROOT}/Resources/Patches/glog-port-cc.diff 103 COMMAND ${PATCH_EXECUTABLE} -N port.cc ${ORTHANC_ROOT}/Resources/Patches/glog-port-cc.diff
87 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows 104 WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows
105 RESULT_VARIABLE Failure
88 ) 106 )
107
108 if (Failure AND FirstRun)
109 message(FATAL_ERROR "Error while patching a file")
110 endif()
89 111
90 elseif (MSVC) 112 elseif (MSVC)
91 # https://code.google.com/p/google-glog/issues/detail?id=117 113 # https://code.google.com/p/google-glog/issues/detail?id=117
92 configure_file( 114 configure_file(
93 ${ORTHANC_ROOT}/Resources/Patches/glog-visual-studio-port.h 115 ${ORTHANC_ROOT}/Resources/Patches/glog-visual-studio-port.h