Mercurial > hg > orthanc
annotate Resources/CMake/GoogleTestConfiguration.cmake @ 2794:f790999a250a
Semaphore removed from graveyard, SystemToolbox::GetHardwareConcurrency()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Jul 2018 14:01:02 +0200 |
parents | d61e73357674 |
children | 0c2a8d5e0097 |
rev | line source |
---|---|
2403
06536b4f30c0
rename USE_GOOGLE_TEST_DEBIAN_SOURCE_PACKAGE as USE_GOOGLE_TEST_DEBIAN_PACKAGE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2402
diff
changeset
|
1 if (USE_GOOGLE_TEST_DEBIAN_PACKAGE) |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
2 find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR |
2159
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
3 NAMES src/gtest-all.cc |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
4 PATHS |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
5 /usr/src/gtest |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
6 /usr/src/googletest/googletest |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
7 PATH_SUFFIXES src |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
8 ) |
157
a63fb54819d7
gtest on debian sid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
9 |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
10 find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR |
2159
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
11 NAMES gtest.h |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
12 PATHS |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
13 /usr/include/gtest |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
14 ) |
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
15 |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
16 message("Path to the Debian Google Test sources: ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}") |
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
17 message("Path to the Debian Google Test includes: ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}") |
2159
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
18 |
2404
e6af2c5cd0f1
migration of Google Test into OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2403
diff
changeset
|
19 set(GOOGLE_TEST_SOURCES |
e6af2c5cd0f1
migration of Google Test into OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2403
diff
changeset
|
20 ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc |
e6af2c5cd0f1
migration of Google Test into OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2403
diff
changeset
|
21 ) |
e6af2c5cd0f1
migration of Google Test into OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2403
diff
changeset
|
22 |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
23 include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR}) |
2159
cfaf2bea096e
fix Google Test includes on Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2113
diff
changeset
|
24 |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
25 if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR |
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
26 NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h) |
157
a63fb54819d7
gtest on debian sid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
27 message(FATAL_ERROR "Please install the libgtest-dev package") |
a63fb54819d7
gtest on debian sid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
28 endif() |
134 | 29 |
634 | 30 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST) |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
31 set(GOOGLE_TEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0) |
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
32 set(GOOGLE_TEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip") |
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
33 set(GOOGLE_TEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7") |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1092
diff
changeset
|
34 |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
35 DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}") |
0 | 36 |
37 include_directories( | |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
38 ${GOOGLE_TEST_SOURCES_DIR}/include |
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
39 ${GOOGLE_TEST_SOURCES_DIR} |
0 | 40 ) |
41 | |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
42 set(GOOGLE_TEST_SOURCES |
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
43 ${GOOGLE_TEST_SOURCES_DIR}/src/gtest-all.cc |
0 | 44 ) |
45 | |
1061
4b4ab35c04f5
fix for visual studio 2012
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
46 # https://code.google.com/p/googletest/issues/detail?id=412 |
4b4ab35c04f5
fix for visual studio 2012
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
47 if (MSVC) # VS2012 does not support tuples correctly yet |
4b4ab35c04f5
fix for visual studio 2012
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
48 add_definitions(/D _VARIADIC_MAX=10) |
4b4ab35c04f5
fix for visual studio 2012
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
49 endif() |
2450
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2404
diff
changeset
|
50 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2404
diff
changeset
|
51 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2404
diff
changeset
|
52 add_definitions(-DGTEST_HAS_CLONE=0) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2404
diff
changeset
|
53 endif() |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2404
diff
changeset
|
54 |
2402
741765ec8374
rename GTEST_ as GOOGLE_TEST_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
55 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*) |
2113
0108ac01fc8e
added source_group directives for MSVC
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
56 |
0 | 57 else() |
58 include(FindGTest) | |
2462
d61e73357674
fix dynamic linking with google-test
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2450
diff
changeset
|
59 if (NOT GTEST_FOUND) |
157
a63fb54819d7
gtest on debian sid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
60 message(FATAL_ERROR "Unable to find GoogleTest") |
a63fb54819d7
gtest on debian sid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
61 endif() |
a63fb54819d7
gtest on debian sid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
62 |
2462
d61e73357674
fix dynamic linking with google-test
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2450
diff
changeset
|
63 include_directories(${GTEST_INCLUDE_DIRS}) |
2404
e6af2c5cd0f1
migration of Google Test into OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2403
diff
changeset
|
64 |
2462
d61e73357674
fix dynamic linking with google-test
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2450
diff
changeset
|
65 # The variable GTEST_LIBRARIES contains the shared library of |
d61e73357674
fix dynamic linking with google-test
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2450
diff
changeset
|
66 # Google Test, create an alias for more uniformity |
d61e73357674
fix dynamic linking with google-test
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2450
diff
changeset
|
67 set(GOOGLE_TEST_LIBRARIES ${GTEST_LIBRARIES}) |
0 | 68 endif() |