From b8c33386113318611df89514a198768615c42c70 Mon Sep 17 00:00:00 2001 From: Andrea Michelotti Date: Thu, 8 Jan 2015 18:23:06 +0100 Subject: [PATCH 1/3] enable shared lib --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47c3b71fb6..b63bb1a00d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,9 @@ option (ENABLE_STATS option (ENABLE_REGEX_URL "Enable url regex matching dispatcher" OFF) +option (SHAREDLIB + "Generate a shared library" OFF) + set (JSONCPP_DIR "${PROJECT_SOURCE_DIR}/../jsoncpp" CACHE STRING "Json C++ directory") @@ -95,7 +98,12 @@ if (WIN32) endif (WIN32) # Compiling library -add_library (mongoose ${SOURCES}) +if (SHAREDLIB) + add_library (mongoose SHARED ${SOURCES}) +else() + add_library (mongoose ${SOURCES}) +endif() + target_link_libraries (mongoose ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) if (HAS_JSONCPP) From 6a90e0a97cc717d8560dc380875bb4d2a81c07da Mon Sep 17 00:00:00 2001 From: Andrea Michelotti Date: Fri, 9 Jan 2015 14:57:34 +0100 Subject: [PATCH 2/3] wrong jsoncpp library name --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b63bb1a00d..ba2d445af7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ endif() target_link_libraries (mongoose ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) if (HAS_JSONCPP) - target_link_libraries (mongoose json) + target_link_libraries (mongoose jsoncpp) endif (HAS_JSONCPP) if (EXAMPLES OR MAIN) From 0e2708866bf12970e3cbe1ee020f4c815c087f85 Mon Sep 17 00:00:00 2001 From: Claudio Bisegni Date: Sun, 11 Jan 2015 15:19:56 +0100 Subject: [PATCH 3/3] Fix and gitingore improvement: -fixed the cake compilation with jsonccp when it is located somewhere -added files to gitignore --- .gitignore | 8 ++++++++ CMakeLists.txt | 14 +++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 378eac25d3..d5c72bc7a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ build +libmongoose.dylib +Makefile +MongooseConfig.cmake +CMakeFiles/cmake.check_cache +cmake_install.cmake +CMakeCache.txt +install_manifest.txt +CMakeFiles diff --git a/CMakeLists.txt b/CMakeLists.txt index ba2d445af7..bdd6243049 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,9 +26,6 @@ option (ENABLE_REGEX_URL option (SHAREDLIB "Generate a shared library" OFF) -set (JSONCPP_DIR "${PROJECT_SOURCE_DIR}/../jsoncpp" - CACHE STRING "Json C++ directory") - set (SOURCES mongoose.c ) @@ -37,6 +34,7 @@ set (MONGOOSE_CPP "${PROJECT_SOURCE_DIR}/mongoose") include_directories ("${PROJECT_SOURCE_DIR}") + if (ENABLE_STATS) add_definitions("-DENABLE_STATS") endif (ENABLE_STATS) @@ -63,13 +61,19 @@ if (CPP_BINDING) ) if (HAS_JSONCPP) + IF(NOT JSONCPP_DIR) + message(STATUS "No path for jsonccp as been given") + set (JSONCPP_DIR "${PROJECT_SOURCE_DIR}/../jsoncpp") + ENDIF() + set (SOURCES ${SOURCES} ${MONGOOSE_CPP}/JsonResponse.cpp ${MONGOOSE_CPP}/JsonController.cpp ) - + message(STATUS "Using ${JSONCPP_DIR}/include and ${JSONCPP_DIR}/lib as jsoncpp path") include_directories ("${JSONCPP_DIR}/include/") + LINK_DIRECTORIES( ${LINK_DIRECTORIES} ${JSONCPP_DIR}/lib/) endif (HAS_JSONCPP) if (WEBSOCKET) @@ -121,7 +125,7 @@ if (MAIN) add_executable (main main.c) target_link_libraries (main mongoose) endif (MAIN) - + # Compiling tests if (EXAMPLES) add_executable (post examples/post.c)