comparison Resources/CMake/MongooseConfiguration.cmake @ 389:9aa8ecbeeeb9

dynamically linking against Mongoose
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Apr 2013 12:36:39 +0200
parents 7593b57dc1bf
children 2b189a3d8e94
comparison
equal deleted inserted replaced
387:ff647eedfbe1 389:9aa8ecbeeeb9
1 SET(MONGOOSE_SOURCES_DIR ${CMAKE_BINARY_DIR}/mongoose) 1 if (STATIC_BUILD OR NOT USE_DYNAMIC_MONGOOSE)
2 DownloadPackage("http://mongoose.googlecode.com/files/mongoose-3.1.tgz" "${MONGOOSE_SOURCES_DIR}" "" "") 2 SET(MONGOOSE_SOURCES_DIR ${CMAKE_BINARY_DIR}/mongoose)
3 DownloadPackage("http://mongoose.googlecode.com/files/mongoose-3.1.tgz" "${MONGOOSE_SOURCES_DIR}" "" "")
3 4
4 # Patch mongoose 5 # Patch mongoose
5 execute_process( 6 execute_process(
6 COMMAND patch mongoose.c ${CMAKE_SOURCE_DIR}/Resources/Patches/mongoose-patch.diff 7 COMMAND patch mongoose.c ${CMAKE_SOURCE_DIR}/Resources/Patches/mongoose-patch.diff
7 WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR} 8 WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR}
8 ) 9 )
9 10
10 include_directories( 11 include_directories(
11 ${MONGOOSE_SOURCES_DIR} 12 ${MONGOOSE_SOURCES_DIR}
12 ) 13 )
13 14
14 list(APPEND THIRD_PARTY_SOURCES 15 list(APPEND THIRD_PARTY_SOURCES
15 ${MONGOOSE_SOURCES_DIR}/mongoose.c 16 ${MONGOOSE_SOURCES_DIR}/mongoose.c
16 ) 17 )
17 18
18 19
19 if (${ENABLE_SSL}) 20 if (${ENABLE_SSL})
20 add_definitions( 21 add_definitions(
21 -DNO_SSL_DL=1 22 -DNO_SSL_DL=1
22 ) 23 )
23 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 24 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
24 link_libraries(dl) 25 link_libraries(dl)
26 endif()
27
28 else()
29 add_definitions(
30 -DNO_SSL=1 # Remove SSL support from mongoose
31 )
25 endif() 32 endif()
26 33
34 source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)
35
27 else() 36 else()
28 add_definitions( 37 CHECK_INCLUDE_FILE_CXX(mongoose.h HAVE_MONGOOSE_H)
29 -DNO_SSL=1 # Remove SSL support from mongoose 38 if (NOT HAVE_MONGOOSE_H)
30 ) 39 message(FATAL_ERROR "Please install the mongoose-devel package")
40 endif()
41
42 CHECK_LIBRARY_EXISTS(mongoose "mg_start" HAVE_MONGOOSE_LIB)
43 if (NOT HAVE_MONGOOSE_LIB)
44 message(FATAL_ERROR "Please install the mongoose-devel package")
45 endif()
46
47 link_libraries(mongoose)
31 endif() 48 endif()
32
33 source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)