Mercurial > hg > orthanc
annotate Resources/CMake/JsonCppConfiguration.cmake @ 2434:63194107e61b
fix issue #31 for good: removing group length correctly
author | amazy |
---|---|
date | Sat, 25 Nov 2017 11:22:53 +0100 |
parents | fe90b3ec9d4a |
children | 0611aa383e62 |
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 |
2429
fe90b3ec9d4a
improvement in Orthanc framework config
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
51 if ((CMAKE_COMPILER_IS_GNUCXX OR |
fe90b3ec9d4a
improvement in Orthanc framework config
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
52 "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND |
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
|
53 JSONCPP_VERSION_MAJOR GREATER 0) |
2429
fe90b3ec9d4a
improvement in Orthanc framework config
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
54 message("Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0") |
1948 | 55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 |
735 | 61 endif() |