1313# along with this program; if not, write to the Free Software
1414# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1515
16- # We want gmock -1.7 .0.zip in order to build these unit tests.
16+ # We want release -1.8 .0.zip in order to build these unit tests.
1717# If you have already downloaded it,
18- # invoke cmake with -DWITH_GMOCK=/path/to/gmock -1.7 .0.zip
18+ # invoke cmake with -DWITH_GMOCK=/path/to/release -1.8 .0.zip
1919# or -DWITH_GMOCK=/path/to
2020#
2121# Alternatively, set an environment variable
22- # export WITH_GMOCK=/path/to/gmock -1.7 .0.zip
22+ # export WITH_GMOCK=/path/to/release -1.8 .0.zip
2323#
2424# You can also do cmake -DENABLE_DOWNLOADS=1
25- # and we will download it from http ://googlemock.googlecode. com
25+ # and we will download it from https ://github. com/google/googletest/archive/
2626#
2727# Either way: we will unpack the zip, compile gmock-all.cc and gtest-all.cc
2828# and link them into the executables.
2929
30+ # Disable googletest for Solaris Studio < 12.4 since it doesn't compile.
31+ IF (CMAKE_C_COMPILER_ID MATCHES "SunPro" )
32+ IF (${CC_MINOR_VERSION} LESS 13)
33+ MESSAGE (WARNING "Googletest requires Solaris Studio 12.4 or newer." )
34+ UNSET (GMOCK_FOUND)
35+ UNSET (GMOCK_FOUND CACHE )
36+ RETURN ()
37+ ENDIF ()
38+ ENDIF ()
39+
3040# Default location for where to download and build gmock/gtest.
3141IF (NOT DOWNLOAD_ROOT)
3242 SET (DOWNLOAD_ROOT ${CMAKE_SOURCE_DIR} /source_downloads)
3343ENDIF ()
3444
35- # We want googlemock version 1.7 , which also contains googletest .
36- SET (GMOCK_PACKAGE_NAME "gmock -1.7 .0" )
45+ # We want googletest version 1.8 , which also contains googlemock .
46+ SET (GMOCK_PACKAGE_NAME "release -1.8 .0" )
3747
3848IF (DEFINED ENV{WITH_GMOCK} AND NOT DEFINED WITH_GMOCK)
3949 FILE (TO_CMAKE_PATH "$ENV{WITH_GMOCK} " WITH_GMOCK)
@@ -56,8 +66,9 @@ IF (WITH_GMOCK)
5666 )
5767 ELSE ()
5868 ## Did we get a path name to the directory of the .zip file?
69+ ## Check for both release-x.y.z.zip and googletest-release-x.y.z.zip
5970 FIND_FILE (LOCAL_GMOCK_ZIP
60- NAMES "${GMOCK_PACKAGE_NAME} .zip"
71+ NAMES "${GMOCK_PACKAGE_NAME} .zip" "googletest- ${GMOCK_PACKAGE_NAME} .zip"
6172 PATHS ${WITH_GMOCK}
6273 NO_DEFAULT_PATH
6374 )
@@ -70,8 +81,8 @@ ENDIF()
7081IF (NOT EXISTS DOWNLOAD_ROOT)
7182 MAKE_DIRECTORY (${DOWNLOAD_ROOT} )
7283ENDIF ()
73- SET (GMOCK_SOURCE_DIR ${DOWNLOAD_ROOT} /${GMOCK_PACKAGE_NAME} )
74- SET (GTEST_SOURCE_DIR ${DOWNLOAD_ROOT} /${GMOCK_PACKAGE_NAME} /gtest )
84+ SET (GMOCK_SOURCE_DIR ${DOWNLOAD_ROOT} /googletest- ${GMOCK_PACKAGE_NAME} /googlemock )
85+ SET (GTEST_SOURCE_DIR ${DOWNLOAD_ROOT} /googletest- ${GMOCK_PACKAGE_NAME} /googletest )
7586
7687# We may have downloaded gmock/gtest already, building in a different directory.
7788IF (EXISTS ${GMOCK_SOURCE_DIR} OR EXISTS ${LOCAL_GMOCK_ZIP} )
@@ -101,37 +112,34 @@ ENDIF()
101112
102113
103114OPTION (ENABLE_DOWNLOADS
104- "Download and build 3rd party source code components, e.g. google mock "
115+ "Download and build 3rd party source code components, e.g. googletest "
105116 OFF )
106117
107118# While experimenting, use local URL rather than google.
108- SET (GMOCK_TARBALL "${GMOCK_PACKAGE_NAME} .zip" )
119+ SET (GMOCK_TARBALL "googletest- ${GMOCK_PACKAGE_NAME} .zip" )
109120SET (GMOCK_DOWNLOAD_URL
110- "http ://googlemock.googlecode. com/files/ ${GMOCK_TARBALL} "
121+ "https ://github. com/google/googletest/archive/ ${GMOCK_PACKAGE_NAME} .zip "
111122 )
112123
113124MACRO (HTTP_PROXY_HINT)
114125 MESSAGE (STATUS
115- "If you are inside a firewall, you may need to use an http proxy: "
116- "export http_proxy =http://example.com:80" )
126+ "If you are inside a firewall, you may need to use an https proxy: "
127+ "export https_proxy =http://example.com:80" )
117128ENDMACRO ()
118129
119130
120131IF (NOT GMOCK_FOUND)
121132 IF (NOT ENABLE_DOWNLOADS)
122- # Give one-time warning
123- IF (NOT ONETIME_GTEST_WARNING)
124- MESSAGE (STATUS
125- "Googlemock was not found. gtest-based unit tests will be disabled. "
126- "You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download "
127- "and build required components from source." )
128- HTTP_PROXY_HINT()
129- SET (ONETIME_GTEST_WARNING 1 CACHE INTERNAL "" )
130- ENDIF ()
133+ # Give warning
134+ MESSAGE (STATUS
135+ "Googletest was not found. gtest-based unit tests will be disabled. "
136+ "You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download "
137+ "and build required components from source." )
138+ HTTP_PROXY_HINT()
131139 RETURN ()
132140 ENDIF ()
133141
134- # Download gmock source
142+ # Download googletest source
135143 IF (NOT EXISTS ${GMOCK_SOURCE_DIR} )
136144 IF (NOT EXISTS ${DOWNLOAD_ROOT} /${GMOCK_TARBALL} )
137145 # Download the tarball
@@ -151,7 +159,7 @@ IF(NOT GMOCK_FOUND)
151159 "Successfully downloaded ${GMOCK_DOWNLOAD_URL} to ${DOWNLOAD_ROOT} " )
152160 ELSE ()
153161 MESSAGE (STATUS
154- "To enable google test , please download ${GMOCK_DOWNLOAD_URL} "
162+ "To enable googletest , please download ${GMOCK_DOWNLOAD_URL} "
155163 "to the directory ${DOWNLOAD_ROOT} " )
156164 HTTP_PROXY_HINT()
157165 RETURN ()
0 commit comments