735
|
1 if (STATIC_BUILD OR NOT USE_SYSTEM_MONGOOSE)
|
|
2 SET(MONGOOSE_SOURCES_DIR ${CMAKE_BINARY_DIR}/mongoose)
|
|
3 DownloadPackage(
|
|
4 "e718fc287b4eb1bd523be3fa00942bb0"
|
|
5 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/mongoose-3.1.tgz"
|
|
6 "${MONGOOSE_SOURCES_DIR}")
|
|
7
|
|
8 # Patch mongoose
|
|
9 execute_process(
|
|
10 COMMAND patch mongoose.c ${CMAKE_SOURCE_DIR}/Resources/Patches/mongoose-patch.diff
|
|
11 WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR}
|
|
12 )
|
|
13
|
|
14 include_directories(
|
|
15 ${MONGOOSE_SOURCES_DIR}
|
|
16 )
|
|
17
|
|
18 list(APPEND THIRD_PARTY_SOURCES
|
|
19 ${MONGOOSE_SOURCES_DIR}/mongoose.c
|
|
20 )
|
|
21
|
|
22
|
|
23 if (${ENABLE_SSL})
|
|
24 add_definitions(
|
|
25 -DNO_SSL_DL=1
|
|
26 )
|
|
27 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
28 link_libraries(dl)
|
|
29 endif()
|
|
30
|
|
31 else()
|
|
32 add_definitions(
|
|
33 -DNO_SSL=1 # Remove SSL support from mongoose
|
|
34 )
|
|
35 endif()
|
|
36
|
|
37
|
|
38 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
39 if (${CMAKE_COMPILER_IS_GNUCXX})
|
|
40 # This is a patch for MinGW64
|
|
41 add_definitions(-D_TIMESPEC_DEFINED=1)
|
|
42 endif()
|
|
43 endif()
|
|
44
|
|
45 source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)
|
|
46
|
|
47 else()
|
|
48 CHECK_INCLUDE_FILE_CXX(mongoose.h HAVE_MONGOOSE_H)
|
|
49 if (NOT HAVE_MONGOOSE_H)
|
|
50 message(FATAL_ERROR "Please install the mongoose-devel package")
|
|
51 endif()
|
|
52
|
|
53 CHECK_LIBRARY_EXISTS(mongoose mg_start "" HAVE_MONGOOSE_LIB)
|
|
54 if (NOT HAVE_MONGOOSE_LIB)
|
|
55 message(FATAL_ERROR "Please install the mongoose-devel package")
|
|
56 endif()
|
|
57
|
|
58 link_libraries(mongoose)
|
|
59 endif()
|