Mercurial > hg > orthanc
annotate Resources/CMake/JsonCppConfiguration.cmake @ 2422:b340f0a9022c
New argument "/.../media?extended" to include additional type-3 tags in DICOMDIR
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 08 Oct 2017 11:46:56 +0200 |
parents | 74d0953a3681 |
children | fe90b3ec9d4a |
rev | line source |
---|---|
735 | 1 if (STATIC_BUILD OR NOT USE_SYSTEM_JSONCPP) |
1502
5e9c40419fb9
Upgrade to JsonCpp 0.10.5 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1414
diff
changeset
|
2 set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.5) |
2384 | 3 set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-0.10.5.tar.gz") |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1502
diff
changeset
|
4 set(JSONCPP_MD5 "db146bac5a126ded9bd728ab7b61ed6b") |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1502
diff
changeset
|
5 |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1502
diff
changeset
|
6 DownloadPackage(${JSONCPP_MD5} ${JSONCPP_URL} "${JSONCPP_SOURCES_DIR}") |
735 | 7 |
1414 | 8 set(JSONCPP_SOURCES |
735 | 9 ${JSONCPP_SOURCES_DIR}/src/lib_json/json_reader.cpp |
10 ${JSONCPP_SOURCES_DIR}/src/lib_json/json_value.cpp | |
11 ${JSONCPP_SOURCES_DIR}/src/lib_json/json_writer.cpp | |
12 ) | |
13 | |
14 include_directories( | |
15 ${JSONCPP_SOURCES_DIR}/include | |
16 ) | |
17 | |
18 source_group(ThirdParty\\JsonCpp REGULAR_EXPRESSION ${JSONCPP_SOURCES_DIR}/.*) | |
19 | |
20 else() | |
1344 | 21 find_path(JSONCPP_INCLUDE_DIR json/reader.h |
22 /usr/include/jsoncpp | |
23 /usr/local/include/jsoncpp | |
24 ) | |
25 | |
26 message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}") | |
27 include_directories(${JSONCPP_INCLUDE_DIR}) | |
735 | 28 link_libraries(jsoncpp) |
29 | |
1405 | 30 CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H) |
31 if (NOT HAVE_JSONCPP_H) | |
32 message(FATAL_ERROR "Please install the libjsoncpp-dev package") | |
33 endif() | |
34 | |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
35 # Switch to the C++11 standard if the version of JsonCpp is 1.y.z |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
36 if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h) |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
37 file(STRINGS |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
38 "${JSONCPP_INCLUDE_DIR}/json/version.h" |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
39 JSONCPP_VERSION_MAJOR1 REGEX |
1948 | 40 ".*define JSONCPP_VERSION_MAJOR.*") |
41 | |
42 if (NOT JSONCPP_VERSION_MAJOR1) | |
43 message(FATAL_ERROR "Unable to extract the major version of JsonCpp") | |
44 endif() | |
45 | |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
46 string(REGEX REPLACE |
1948 | 47 ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
48 JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1}) |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
49 message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}") |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
50 |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
51 if (CMAKE_COMPILER_IS_GNUCXX AND |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
52 JSONCPP_VERSION_MAJOR GREATER 0) |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
53 message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0") |
1948 | 54 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations") |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
55 endif() |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
56 else() |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
57 message("Unable to detect the major version of JsonCpp, assuming < 1.0.0") |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
58 endif() |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
59 |
735 | 60 endif() |