comparison Resources/CMake/GoogleTestConfiguration.cmake @ 2402:741765ec8374

rename GTEST_ as GOOGLE_TEST_
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 08 Sep 2017 16:32:59 +0200
parents 74d0953a3681
children 06536b4f30c0
comparison
equal deleted inserted replaced
2401:a051aba0037c 2402:741765ec8374
1 if (USE_GTEST_DEBIAN_SOURCE_PACKAGE) 1 if (USE_GOOGLE_TEST_DEBIAN_SOURCE_PACKAGE)
2 find_path(GTEST_DEBIAN_SOURCES_DIR 2 find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR
3 NAMES src/gtest-all.cc 3 NAMES src/gtest-all.cc
4 PATHS 4 PATHS
5 /usr/src/gtest 5 /usr/src/gtest
6 /usr/src/googletest/googletest 6 /usr/src/googletest/googletest
7 PATH_SUFFIXES src 7 PATH_SUFFIXES src
8 ) 8 )
9 9
10 find_path(GTEST_DEBIAN_INCLUDE_DIR 10 find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR
11 NAMES gtest.h 11 NAMES gtest.h
12 PATHS 12 PATHS
13 /usr/include/gtest 13 /usr/include/gtest
14 ) 14 )
15 15
16 message("Path to the Debian Google Test sources: ${GTEST_DEBIAN_SOURCES_DIR}") 16 message("Path to the Debian Google Test sources: ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}")
17 message("Path to the Debian Google Test includes: ${GTEST_DEBIAN_INCLUDE_DIR}") 17 message("Path to the Debian Google Test includes: ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}")
18 18
19 set(GTEST_SOURCES ${GTEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc) 19 set(GOOGLE_TEST_SOURCES ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc)
20 include_directories(${GTEST_DEBIAN_SOURCES_DIR}) 20 include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR})
21 21
22 if (NOT EXISTS ${GTEST_SOURCES} OR 22 if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR
23 NOT EXISTS ${GTEST_DEBIAN_INCLUDE_DIR}/gtest.h) 23 NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h)
24 message(FATAL_ERROR "Please install the libgtest-dev package") 24 message(FATAL_ERROR "Please install the libgtest-dev package")
25 endif() 25 endif()
26 26
27 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST) 27 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST)
28 set(GTEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0) 28 set(GOOGLE_TEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0)
29 set(GTEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip") 29 set(GOOGLE_TEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip")
30 set(GTEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7") 30 set(GOOGLE_TEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7")
31 31
32 DownloadPackage(${GTEST_MD5} ${GTEST_URL} "${GTEST_SOURCES_DIR}") 32 DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}")
33 33
34 include_directories( 34 include_directories(
35 ${GTEST_SOURCES_DIR}/include 35 ${GOOGLE_TEST_SOURCES_DIR}/include
36 ${GTEST_SOURCES_DIR} 36 ${GOOGLE_TEST_SOURCES_DIR}
37 ) 37 )
38 38
39 set(GTEST_SOURCES 39 set(GOOGLE_TEST_SOURCES
40 ${GTEST_SOURCES_DIR}/src/gtest-all.cc 40 ${GOOGLE_TEST_SOURCES_DIR}/src/gtest-all.cc
41 ) 41 )
42 42
43 # https://code.google.com/p/googletest/issues/detail?id=412 43 # https://code.google.com/p/googletest/issues/detail?id=412
44 if (MSVC) # VS2012 does not support tuples correctly yet 44 if (MSVC) # VS2012 does not support tuples correctly yet
45 add_definitions(/D _VARIADIC_MAX=10) 45 add_definitions(/D _VARIADIC_MAX=10)
46 endif() 46 endif()
47 47
48 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GTEST_SOURCES_DIR}/.*) 48 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*)
49 49
50 else() 50 else()
51 include(FindGTest) 51 include(FindGTest)
52 if (NOT GTEST_FOUND) 52 if (NOT GOOGLE_TEST_FOUND)
53 message(FATAL_ERROR "Unable to find GoogleTest") 53 message(FATAL_ERROR "Unable to find GoogleTest")
54 endif() 54 endif()
55 55
56 include_directories(${GTEST_INCLUDE_DIRS}) 56 include_directories(${GOOGLE_TEST_INCLUDE_DIRS})
57 link_libraries(${GTEST_LIBRARIES}) 57 link_libraries(${GOOGLE_TEST_LIBRARIES})
58 endif() 58 endif()