version 0.2.11
[fms.git] / CMakeLists.txt
index 024be6a..ebff758 100644 (file)
@@ -1,5 +1,8 @@
 PROJECT(fms)\r
 \r
+OPTION(USE_BUNDLED_SQLITE "Use the bundled SQLite3 library." OFF)\r
+OPTION(DO_CHARSET_CONVERSION "Do charset conversion on sent messages to UTF-8.  This requires libiconv." OFF)\r
+\r
 SET(FMS_SRC \r
 src/base64.cpp\r
 src/board.cpp\r
@@ -8,6 +11,7 @@ src/commandthread.cpp
 src/datetime.cpp\r
 src/global.cpp\r
 src/hex.cpp\r
+src/localidentity.cpp\r
 src/logfile.cpp\r
 src/main.cpp\r
 src/message.cpp\r
@@ -20,7 +24,11 @@ src/uuidgenerator.cpp
 src/db/sqlite3db.cpp\r
 src/db/sqlite3recordset.cpp\r
 src/db/sqlite3statement.cpp\r
+src/freenet/boardlistinserter.cpp\r
+src/freenet/boardlistrequester.cpp\r
+src/freenet/boardlistxml.cpp\r
 src/freenet/fcpv2.cpp\r
+src/freenet/fileinserter.cpp\r
 src/freenet/freenetmasterthread.cpp\r
 src/freenet/freenetssk.cpp\r
 src/freenet/identityinserter.cpp\r
@@ -39,6 +47,7 @@ src/freenet/messagelistxml.cpp
 src/freenet/messagerequester.cpp\r
 src/freenet/messagexml.cpp\r
 src/freenet/periodicdbmaintenance.cpp\r
+src/freenet/siteinserter.cpp\r
 src/freenet/trustlistinserter.cpp\r
 src/freenet/trustlistrequester.cpp\r
 src/freenet/trustlistxml.cpp\r
@@ -52,12 +61,16 @@ src/http/identityexportxml.cpp
 src/http/ipagehandler.cpp\r
 src/http/pages/addpeerpage.cpp\r
 src/http/pages/announceidentitypage.cpp\r
+src/http/pages/boardspage.cpp\r
 src/http/pages/controlboardpage.cpp\r
 src/http/pages/createidentitypage.cpp\r
+src/http/pages/execquerypage.cpp\r
 src/http/pages/homepage.cpp\r
+src/http/pages/insertedfilespage.cpp\r
 src/http/pages/localidentitiespage.cpp\r
 src/http/pages/optionspage.cpp\r
 src/http/pages/peerdetailspage.cpp\r
+src/http/pages/peermaintenancepage.cpp\r
 src/http/pages/peertrustpage.cpp\r
 src/http/pages/showcaptchapage.cpp\r
 src/nntp/nntpconnection.cpp\r
@@ -75,6 +88,10 @@ src/pthreadwrapper/threadedexecutor.cpp
 src/xyssl/sha1.c\r
 )\r
 \r
+IF(DO_CHARSET_CONVERSION)\r
+       SET(FMS_SRC ${FMS_SRC} src/charsetconverter.cpp)\r
+ENDIF(DO_CHARSET_CONVERSION)\r
+\r
 IF(WIN32)\r
        SET(FMS_PLATFORM_SRC src/fmsservice.cpp)\r
 ELSE(WIN32)\r
@@ -91,24 +108,46 @@ ADD_DEFINITIONS(-DTIXML_USE_STL)
 \r
 ADD_EXECUTABLE(fms ${FMS_SRC} ${FMS_PLATFORM_SRC})\r
 \r
-# For SQLite3 and shttpd\r
+# link dl - For SQLite3 and shttpd - not for FreeBSD\r
 IF(CMAKE_COMPILER_IS_GNUCC)\r
-       TARGET_LINK_LIBRARIES(fms dl)\r
+       IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")\r
+       ELSE(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")\r
+               TARGET_LINK_LIBRARIES(fms dl)\r
+       ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")\r
 ENDIF(CMAKE_COMPILER_IS_GNUCC)\r
 \r
+# add -lcompat only for FreeBSD\r
+IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")\r
+       IF(CMAKE_COMPILER_IS_GNUCXX)\r
+               TARGET_LINK_LIBRARIES(fms compat)\r
+       ENDIF(CMAKE_COMPILER_IS_GNUCXX)\r
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")\r
+\r
+# link ws2_32 for Windows\r
 IF(WIN32)\r
        TARGET_LINK_LIBRARIES(fms ws2_32)\r
 ENDIF(WIN32)\r
 \r
-FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3_s)\r
+# add -lxnet and -lsocket on solaris\r
+IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")\r
+       TARGET_LINK_LIBRARIES(fms xnet)\r
+       TARGET_LINK_LIBRARIES(fms socket)\r
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")\r
+\r
+IF(NOT USE_BUNDLED_SQLITE)\r
+       FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3_s)\r
+ENDIF(NOT USE_BUNDLED_SQLITE)\r
 FIND_LIBRARY(TINYXML_LIBRARY NAMES tinyxml tinyxml_s)\r
 FIND_LIBRARY(PTHREADS_LIBRARY NAMES pthread pthreads pthreadvc2)\r
-FIND_LIBRARY(SHTTPD_LIBRARY NAMES shttpd)\r
+FIND_LIBRARY(SHTTPD_LIBRARY NAMES shttpd shttpd_s)\r
+FIND_LIBRARY(ICONV_LIBRARY NAMES iconv iconv_s libiconv libiconv_s)\r
 \r
 IF(SQLITE3_LIBRARY)\r
        TARGET_LINK_LIBRARIES(fms ${SQLITE3_LIBRARY})\r
 ELSE(SQLITE3_LIBRARY)\r
-       MESSAGE(STATUS "Could not find system SQLite library.  Will compile from included source.")\r
+       IF(NOT USE_BUNDLED_SQLITE)\r
+               MESSAGE(STATUS "Could not find system SQLite library.  Will compile from included source.")\r
+       ENDIF(NOT USE_BUNDLED_SQLITE)\r
        ADD_LIBRARY(sqlite3 libs/sqlite3/sqlite3.c)\r
        TARGET_LINK_LIBRARIES(fms sqlite3)\r
        INCLUDE_DIRECTORIES(libs/sqlite3)\r
@@ -141,6 +180,17 @@ ELSE(SHTTPD_LIBRARY)
        ELSE(WIN32)\r
                SET(SHTTPD_PLATFORM_SRC libs/shttpd/compat_unix.c)\r
        ENDIF(WIN32)\r
-       ADD_LIBRARY(shttpd ${SHTTPD_PLATFORM_SRC} libs/shttpd/auth.c libs/shttpd/cgi.c libs/shttpd/config.c libs/shttpd/io_cgi.c libs/shttpd/io_dir.c libs/shttpd/io_emb.c libs/shttpd/io_file.c libs/shttpd/io_socket.c libs/shttpd/io_ssi.c libs/shttpd/io_ssl.c libs/shttpd/log.c libs/shttpd/md5.c libs/shttpd/mime_type.c libs/shttpd/shttpd.c libs/shttpd/string.c)\r
+       ADD_LIBRARY(shttpd ${SHTTPD_PLATFORM_SRC} libs/shttpd/auth.c libs/shttpd/cgi.c libs/shttpd/config.c libs/shttpd/io_cgi.c libs/shttpd/io_dir.c libs/shttpd/io_emb.c libs/shttpd/io_file.c libs/shttpd/io_socket.c libs/shttpd/io_ssi.c libs/shttpd/io_ssl.c libs/shttpd/log.c libs/shttpd/md5.c libs/shttpd/shttpd.c libs/shttpd/string.c)\r
        TARGET_LINK_LIBRARIES(fms shttpd)\r
 ENDIF(SHTTPD_LIBRARY)\r
+\r
+IF(DO_CHARSET_CONVERSION)\r
+       ADD_DEFINITIONS(-DDO_CHARSET_CONVERSION)\r
+       IF(ICONV_LIBRARY)\r
+               TARGET_LINK_LIBRARIES(fms ${ICONV_LIBRARY})\r
+       ELSE(ICONV_LIBRARY)\r
+               IF(WIN32)\r
+                       MESSAGE(FATAL ERROR "Could not find iconv library.  You must set the location manually, or turn off charset conversion.")\r
+               ENDIF(WIN32)\r
+       ENDIF(ICONV_LIBRARY)\r
+ENDIF(DO_CHARSET_CONVERSION)\r