Mercurial > hg > orthanc-webviewer
comparison Orthanc/Resources/CMake/GoogleTestConfiguration.cmake @ 172:330ecfd96aec
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Oct 2017 12:53:46 +0200 |
parents | 08f30c8962a7 |
children | dd1ad819ca33 |
comparison
equal
deleted
inserted
replaced
171:b6c55352818c | 172:330ecfd96aec |
---|---|
1 if (USE_GTEST_DEBIAN_SOURCE_PACKAGE) | 1 if (USE_GOOGLE_TEST_DEBIAN_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 |
20 include_directories(${GTEST_DEBIAN_SOURCES_DIR}) | 20 ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc |
21 ) | |
21 | 22 |
22 if (NOT EXISTS ${GTEST_SOURCES} OR | 23 include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR}) |
23 NOT EXISTS ${GTEST_DEBIAN_INCLUDE_DIR}/gtest.h) | 24 |
25 if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR | |
26 NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h) | |
24 message(FATAL_ERROR "Please install the libgtest-dev package") | 27 message(FATAL_ERROR "Please install the libgtest-dev package") |
25 endif() | 28 endif() |
26 | 29 |
27 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST) | 30 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST) |
28 set(GTEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0) | 31 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") | 32 set(GOOGLE_TEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip") |
30 set(GTEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7") | 33 set(GOOGLE_TEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7") |
31 | 34 |
32 DownloadPackage(${GTEST_MD5} ${GTEST_URL} "${GTEST_SOURCES_DIR}") | 35 DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}") |
33 | 36 |
34 include_directories( | 37 include_directories( |
35 ${GTEST_SOURCES_DIR}/include | 38 ${GOOGLE_TEST_SOURCES_DIR}/include |
36 ${GTEST_SOURCES_DIR} | 39 ${GOOGLE_TEST_SOURCES_DIR} |
37 ) | 40 ) |
38 | 41 |
39 set(GTEST_SOURCES | 42 set(GOOGLE_TEST_SOURCES |
40 ${GTEST_SOURCES_DIR}/src/gtest-all.cc | 43 ${GOOGLE_TEST_SOURCES_DIR}/src/gtest-all.cc |
41 ) | 44 ) |
42 | 45 |
43 # https://code.google.com/p/googletest/issues/detail?id=412 | 46 # https://code.google.com/p/googletest/issues/detail?id=412 |
44 if (MSVC) # VS2012 does not support tuples correctly yet | 47 if (MSVC) # VS2012 does not support tuples correctly yet |
45 add_definitions(/D _VARIADIC_MAX=10) | 48 add_definitions(/D _VARIADIC_MAX=10) |
46 endif() | 49 endif() |
47 | 50 |
48 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GTEST_SOURCES_DIR}/.*) | 51 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*) |
49 | 52 |
50 else() | 53 else() |
51 include(FindGTest) | 54 include(FindGTest) |
52 if (NOT GTEST_FOUND) | 55 if (NOT GOOGLE_TEST_FOUND) |
53 message(FATAL_ERROR "Unable to find GoogleTest") | 56 message(FATAL_ERROR "Unable to find GoogleTest") |
54 endif() | 57 endif() |
55 | 58 |
56 include_directories(${GTEST_INCLUDE_DIRS}) | 59 include_directories(${GOOGLE_TEST_INCLUDE_DIRS}) |
57 link_libraries(${GTEST_LIBRARIES}) | 60 |
61 # The variable GOOGLE_TEST_LIBRARIES contains the shared library of | |
62 # Google Test | |
58 endif() | 63 endif() |