"Fossies" - the Fresh Open Source Software Archive

Member "sarg-2.4.0/CMakeLists.txt" (16 Jan 2020, 15781 Bytes) of package /linux/privat/sarg-2.4.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 2.3.11_vs_2.4.0.

    1 CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
    2 PROJECT(sarg C)
    3 SET(sarg_VERSION 2)
    4 SET(sarg_REVISION "4.0")
    5 SET(sarg_BUILD "")
    6 SET(sarg_BUILDDATE "Jan-16-2020")
    7 
    8 INCLUDE(AddFileDependencies)
    9 INCLUDE(CheckIncludeFile)
   10 INCLUDE(CheckLibraryExists)
   11 INCLUDE(CheckFunctionExists)
   12 INCLUDE(CheckTypeSize)
   13 INCLUDE(CheckSymbolExists)
   14 INCLUDE(CheckCCompilerFlag)
   15 INCLUDE(CheckStructHasMember)
   16 
   17 DEFINE_PROPERTY(GLOBAL PROPERTY enable-htmldir BRIEF_DOCS "--enable-htmldir=htmldir"
   18                         FULL_DOCS "Select htmldir as the root of your WWW documents")
   19 
   20 SET(PACKAGE_NAME "sarg")
   21 SET(PACKAGE_VERSION "${sarg_VERSION}.${sarg_REVISION}${sarg_BUILD}")
   22 
   23 MACRO(SET_ABS_SOURCE VAR DOC)
   24    IF(${VAR} AND NOT ${VAR}_SOURCE)
   25       SET(PATH "${${VAR}}")
   26       IF(NOT IS_ABSOLUTE ${PATH})
   27          SET(PATH "${CMAKE_INSTALL_PREFIX}/${PATH}")
   28       ENDIF(NOT IS_ABSOLUTE ${PATH})
   29       GET_FILENAME_COMPONENT(SOURCE_PATH "${PATH}" ABSOLUTE)
   30       SET(${VAR}_SOURCE "${SOURCE_PATH}" CACHE PATH "${DOC}")
   31    ENDIF(${VAR} AND NOT ${VAR}_SOURCE)
   32 ENDMACRO(SET_ABS_SOURCE VAR DOC)
   33 
   34 SET_ABS_SOURCE(SYSCONFDIR "The full path of the configuration directory to be compiled in the program")
   35 SET_ABS_SOURCE(FONTDIR "The full path of the fonts directory to be compiled in the program")
   36 SET_ABS_SOURCE(IMAGEDIR "The full path of the images directory to be compiled in the program")
   37 
   38 SET(SYSCONFDIR "etc/sarg" CACHE PATH "The configuration directory relative to the install directory")
   39 SET(BINDIR "bin" CACHE PATH "The directory to install the exec relative to the install directory")
   40 SET(MANDIR "share/man/man1" CACHE PATH "The directory to copy the man page relative to the install directory")
   41 SET(FONTDIR "share/sarg/fonts" CACHE PATH "The directory to copy the fonts relative to the install directory")
   42 SET(IMAGEDIR "share/sarg/images" CACHE PATH "The directory to copy the images files relative to the install directory")
   43 SET(SARGPHPDIR "share/sarg/sarg-php" CACHE PATH "The directory to copy sarg-php relative to the install directory")
   44 
   45 # Sources to compile
   46 INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}") #Make it find this config.h before the one in src/include
   47 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include")
   48 SET(SRC util.c log.c report.c topuser.c email.c sort.c html.c
   49        index.c getconf.c usage.c decomp.c ip2name.c ip2name_dns.c
   50        useragent.c exclude.c convlog.c totday.c repday.c datafile.c
   51        indexonly.c splitlog.c lastlog.c topsites.c siteuser.c css.c
   52        smartfilter.c denied.c authfail.c dichotomic.c
   53        redirector.c auth.c download.c grepday.c ip2name_exec.c
   54        dansguardian_log.c dansguardian_report.c realtime.c btree_cache.c
   55        usertab.c userinfo.c longline.c url.c fnmatch.c stringbuffer.c
   56        filelist.c readlog.c alias.c
   57 	   readlog_squid.c readlog_sarg.c readlog_extlog.c readlog_common.c
   58 	   include/conf.h include/info.h include/defs.h include/stringbuffer.h)
   59 
   60 FOREACH(f ${SRC})
   61    ADD_FILE_DEPENDENCIES(${f} ${CMAKE_BINARY_DIR}/config.h ${CMAKE_SOURCE_DIR}/include/conf.h ${CMAKE_SOURCE_DIR}/include/info.h ${CMAKE_SOURCE_DIR}/include/defs.h)
   62 ENDFOREACH(f)
   63 
   64 ADD_EXECUTABLE(sarg ${SRC})
   65 
   66 SET_TARGET_PROPERTIES(sarg PROPERTIES VERSION "${sarg_VERSION}.${sarg_REVISION}.${sarg_BUILD}")
   67 
   68 SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "$ENV{CFLAGS} -Wall -Wno-sign-compare")
   69 SET_TARGET_PROPERTIES(sarg PROPERTIES LINK_FLAGS "$ENV{LDFLAGS}")
   70 
   71 CHECK_C_COMPILER_FLAG("-Wextra" HAVE_WEXTRA)
   72 IF(HAVE_WEXTRA)
   73    # Not supported by gcc 3.3
   74    GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
   75    SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Wextra -Wno-unused-parameter")
   76 ENDIF(HAVE_WEXTRA)
   77 
   78 CHECK_C_COMPILER_FLAG("-Werror=implicit-function-declaration" HAVE_WERROR_IMPLICIT_FUNCTION)
   79 IF(HAVE_WERROR_IMPLICIT_FUNCTION)
   80    GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
   81    SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Werror=implicit-function-declaration")
   82 ENDIF(HAVE_WERROR_IMPLICIT_FUNCTION)
   83 
   84 CHECK_C_COMPILER_FLAG("-Werror=format" HAVE_WERROR_FORMAT)
   85 IF(HAVE_WERROR_FORMAT)
   86    GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
   87    SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Werror=format")
   88 ENDIF(HAVE_WERROR_FORMAT)
   89 
   90 # Required header files
   91 CHECK_INCLUDE_FILE(stdio.h HAVE_STDIO_H)
   92 CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
   93 CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
   94 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
   95 CHECK_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H)
   96 CHECK_INCLUDE_FILE(time.h HAVE_TIME_H)
   97 CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
   98 CHECK_INCLUDE_FILE(sys/dirent.h HAVE_SYS_DIRENT_H)
   99 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
  100 CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
  101 CHECK_INCLUDE_FILE(sys/socket.h HAVE_SYS_SOCKET_H)
  102 CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H)
  103 CHECK_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H)
  104 CHECK_INCLUDE_FILE(netinet/in.h HAVE_NETINET_H)
  105 CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
  106 CHECK_INCLUDE_FILE(ctype.h HAVE_CTYPE_H)
  107 CHECK_INCLUDE_FILE(errno.h HAVE_ERRNO_H)
  108 CHECK_INCLUDE_FILE(sys/resource.h HAVE_SYS_RESOURCE_H)
  109 CHECK_INCLUDE_FILE(sys/wait.h HAVE_SYS_WAIT_H)
  110 CHECK_INCLUDE_FILE(stdarg.h HAVE_STDARG_H)
  111 CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
  112 CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H)
  113 CHECK_INCLUDE_FILE(math.h HAVE_MATH_H)
  114 CHECK_INCLUDE_FILE(locale.h HAVE_LOCALE_H)
  115 CHECK_INCLUDE_FILE(execinfo.h HAVE_EXECINFO_H)
  116 CHECK_INCLUDE_FILE(libintl.h HAVE_LIBINTL_H)
  117 CHECK_INCLUDE_FILE(libgen.h HAVE_LIBGEN_H)
  118 CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
  119 CHECK_INCLUDE_FILE(getopt.h HAVE_GETOPT_H)
  120 CHECK_INCLUDE_FILE(fcntl.h HAVE_FCNTL_H)
  121 CHECK_INCLUDE_FILE(fnmatch.h HAVE_FNMATCH_H)
  122 CHECK_INCLUDE_FILE(glob.h HAVE_GLOB_H)
  123 
  124 IF(!HAVE_GETOPT_H)
  125    MESSAGE(SEND_ERROR "getopt.h is required to compile sarg")
  126 ENDIF(!HAVE_GETOPT_H)
  127 
  128 # Required libraries
  129 TARGET_LINK_LIBRARIES(sarg m)
  130 
  131 # Windows need lib wsock32 and ws2_32
  132 IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
  133    CHECK_INCLUDE_FILE(winsock2.h HAVE_WINSOCK2_H)
  134    CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
  135    CHECK_INCLUDE_FILE(winsock.h HAVE_WINSOCK_H)
  136    CHECK_INCLUDE_FILE(ws2tcpip.h HAVE_WS2TCPIP_H)
  137    CHECK_INCLUDE_FILE(direct.h HAVE_DIRECT_H)
  138 
  139    FIND_LIBRARY(WSOCK_LIB NAMES wsock32 DOC "The winsock library")
  140    IF(WSOCK_LIB)
  141       TARGET_LINK_LIBRARIES(sarg wsock32)
  142       LIST(APPEND CMAKE_REQUIRED_LIBRARIES wsock32)
  143    ENDIF(WSOCK_LIB)
  144 
  145    FIND_LIBRARY(WSOCK2_LIB NAMES ws2_32 DOC "The winsock 2 library")
  146    IF(WSOCK2_LIB)
  147       TARGET_LINK_LIBRARIES(sarg ws2_32)
  148       LIST(APPEND CMAKE_REQUIRED_LIBRARIES ws2_32)
  149    ENDIF(WSOCK2_LIB)
  150 
  151    ADD_DEFINITIONS(-DWINDOWS)
  152 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
  153 
  154 CHECK_FUNCTION_EXISTS(backtrace HAVE_BACKTRACE)
  155 CHECK_FUNCTION_EXISTS(symlink HAVE_SYMLINK)
  156 CHECK_FUNCTION_EXISTS(lstat HAVE_LSTAT)
  157 CHECK_FUNCTION_EXISTS(getnameinfo HAVE_GETNAMEINFO)
  158 CHECK_FUNCTION_EXISTS(getaddrinfo HAVE_GETADDRINFO)
  159 CHECK_FUNCTION_EXISTS(inet_aton HAVE_INET_ATON)
  160 CHECK_FUNCTION_EXISTS(fnmatch HAVE_FNMATCH)
  161 
  162 CHECK_STRUCT_HAS_MEMBER("struct sockaddr_storage" ss_len sys/socket.h HAVE_SOCKADDR_SA_LEN)
  163 
  164 # Find gd
  165 CHECK_INCLUDE_FILE(gd.h HAVE_GD_H)
  166 IF(HAVE_GD_H)
  167    CHECK_INCLUDE_FILE(gdfontl.h HAVE_GDFONTL_H)
  168    CHECK_INCLUDE_FILE(gdfontt.h HAVE_GDFONTT_H)
  169    CHECK_INCLUDE_FILE(gdfonts.h HAVE_GDFONTS_H)
  170    CHECK_INCLUDE_FILE(gdfontmb.h HAVE_GDFONTMB_H)
  171    CHECK_INCLUDE_FILE(gdfontg.h HAVE_GDFONTG_H)
  172    FIND_LIBRARY(GD_LIBRARY NAMES gd bgd DOC "The GD library")
  173    IF(GD_LIBRARY)
  174       #CHECK_LIBRARY_EXISTS(gd gdImagePng "." HAVE_GD_LIB)
  175       TARGET_LINK_LIBRARIES(sarg ${GD_LIBRARY})
  176       SET(HAVE_GD_LIB GD_LIBRARY CACHE PATH DOC "True IF GD was found")
  177       SET(HAVE_GD_LIB CACHE BOOL DOC "True IF must use GD")
  178    ENDIF(GD_LIBRARY)
  179 ENDIF(HAVE_GD_H)
  180 
  181 # Find iconv
  182 OPTION(ENABLE_ICONV "Enable the usage of iconv" ON)
  183 IF(ENABLE_ICONV)
  184    CHECK_INCLUDE_FILE(iconv.h HAVE_ICONV_H)
  185    IF(HAVE_ICONV_H)
  186       FIND_PATH(ICONV_INCLUDE_PATH NAMES iconv.h)
  187       FIND_LIBRARY(ICONV_LIBRARY NAMES iconv DOC "The ICONV library")
  188       IF(ICONV_LIBRARY)
  189          TARGET_LINK_LIBRARIES(sarg ${ICONV_LIBRARY})
  190       ENDIF(ICONV_LIBRARY)
  191       CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV)
  192 
  193       IF(NOT USE_CONST_ICONV)
  194          SET(ICONV_CONST_FILE ${CMAKE_BINARY_DIR}/consticonv.c)
  195          FILE(WRITE ${ICONV_CONST_FILE} "
  196 #include <iconv.h>
  197 #ifdef __CLASSIC_C__
  198 int main(){
  199   int ac;
  200   char*av[];
  201 #else
  202 int main(int ac, char*av[]){
  203 #endif
  204   iconv_t localtoutf=(iconv_t)-1;
  205   const char *str=\"\";
  206   char *sstr=\"\";
  207   size_t slen=0, sslen=0;
  208 
  209   iconv (localtoutf, (const char **)&str, &slen, &sstr, &sslen);
  210   if(ac > 1000)
  211     {
  212     return *av[0];
  213     }
  214   return 0;
  215 }
  216 ")
  217          TRY_COMPILE(USE_CONST_ICONV ${CMAKE_BINARY_DIR} ${ICONV_CONST_FILE} CMAKE_FLAGS -DLINK_LIBRARIES="iconv")
  218          FILE(REMOVE ${ICONV_CONST_FILE})
  219          IF(USE_CONST_ICONV)
  220             SET(ICONV_CONST "const" CACHE STRING "The type of char to use with iconv")
  221             MESSAGE(STATUS "iconv requires const char **")
  222          ELSEIF(USE_CONST_ICONV)
  223             SET(ICONV_CONST "" CACHE STRING "The type of char to use with iconv")
  224             MESSAGE(STATUS "iconv requires char **")
  225          ENDIF(USE_CONST_ICONV)
  226          SET(USE_CONST_ICONV TRUE CACHE BOOL "Use const char ** with iconv")
  227       ENDIF(NOT USE_CONST_ICONV)
  228    ENDIF(HAVE_ICONV_H)
  229 ENDIF(ENABLE_ICONV)
  230 
  231 # Find ldap
  232 CHECK_INCLUDE_FILE(ldap.h HAVE_LDAP_H)
  233 IF(HAVE_LDAP_H)
  234    FIND_LIBRARY(LDAP_LIBRARY NAMES ldap DOC "The ldap library")
  235    IF(LDAP_LIBRARY)
  236       TARGET_LINK_LIBRARIES(sarg ${LDAP_LIBRARY})
  237       SET(HAVE_LDAP LDAP_LIBRARY CACHE PATH DOC "True if LDAP was found")
  238       SET(HAVE_LDAP CACHE BOOL DOC "True if must use LDAP")
  239    ENDIF(LDAP_LIBRARY)
  240 ENDIF(HAVE_LDAP_H)
  241 
  242 # Find pcre
  243 CHECK_INCLUDE_FILE(pcre.h HAVE_PCRE_H)
  244 IF(HAVE_PCRE_H)
  245    FIND_LIBRARY(PCRE_LIBRARY NAMES pcre DOC "The pcre library")
  246    IF(PCRE_LIBRARY)
  247       TARGET_LINK_LIBRARIES(sarg ${PCRE_LIBRARY})
  248       SET(HAVE_PCRE PCRE_LIBRARY CACHE PATH DOC "True if pcre was found")
  249       SET(HAVE_PCRE CACHE BOOL DOC "True if must use pcre")
  250    ENDIF(PCRE_LIBRARY)
  251 ENDIF(HAVE_PCRE_H)
  252 
  253 # Support for large files
  254 OPTION(ENABLE_LARGEFILE "Enable the usage of large files" ON)
  255 IF(ENABLE_LARGEFILE)
  256    IF(LFS_SEARCHED MATCHES "^LFS_SEARCHED$")
  257       SET(SEARCH_LARGEFILE TRUE)
  258    ENDIF(LFS_SEARCHED MATCHES "^LFS_SEARCHED$")
  259 ENDIF(ENABLE_LARGEFILE)
  260 
  261 IF(SEARCH_LARGEFILE)
  262    SET(LFS_SEARCHED TRUE CACHE INTERNAL "LFS has been searched")
  263    MESSAGE(STATUS "Looking for large file support")
  264    SET(LFS_FILE "${CMAKE_BINARY_DIR}/lfsfopen64.c")
  265    FILE(WRITE ${LFS_FILE} "
  266 #include <stdio.h>
  267 int main(void)
  268 {
  269 FILE *f = fopen64 (\"/tmp/foo\",\"r\");
  270 return(0);
  271 }
  272 ")
  273    TRY_COMPILE(HAVE_FOPEN64 ${CMAKE_BINARY_DIR} ${LFS_FILE} COMPILE_DEFINITIONS "-Wall -Werror")
  274    IF(HAVE_FOPEN64)
  275       MESSAGE(STATUS "Looking for large file support - found")
  276    ELSE(HAVE_FOPEN64)
  277       SET(LFS_NEED_DEFINE FALSE CACHE BOOL "Does LFS require _LARGEFILE64_SOURCE ?")
  278       MESSAGE(STATUS "Looking for large file support with _LARGEFILE64_SOURCE")
  279       FILE(WRITE ${LFS_FILE} "
  280 #define _LARGEFILE64_SOURCE
  281 #include <stdio.h>
  282 int main(void)
  283 {
  284 FILE *f = fopen64 (\"/tmp/foo\",\"r\");
  285 return(0);
  286 }
  287 ")
  288       TRY_COMPILE(HAVE_FOPEN64 ${CMAKE_BINARY_DIR} ${LFS_FILE} OUTPUT_VARIABLE LFS_OUTPUT)
  289       IF(HAVE_FOPEN64)
  290          MESSAGE(STATUS "Looking for large file support with _LARGEFILE64_SOURCE - found")
  291          SET(LFS_NEED_DEFINE TRUE CACHE BOOL "Does LFS require _LARGEFILE64_SOURCE ?" FORCE)
  292       ELSE(HAVE_FOPEN64)
  293          MESSAGE("Failed with output ${LFS_OUTPUT}")
  294       ENDIF(HAVE_FOPEN64)
  295    ENDIF(HAVE_FOPEN64)
  296    FILE(REMOVE ${LFS_FILE})
  297 ENDIF(SEARCH_LARGEFILE)
  298 
  299 IF(LFS_NEED_DEFINE)
  300    ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE)
  301 ENDIF(LFS_NEED_DEFINE)
  302 
  303 # Find rlim_t
  304 IF(HAVE_SYS_RESOURCE_H)
  305    SET(CMAKE_EXTRA_INCLUDE_FILES "sys/resource.h")
  306 ENDIF(HAVE_SYS_RESOURCE_H)
  307 CHECK_TYPE_SIZE(rlim_t RLIM_T)
  308 IF(HAVE_RLIM_T)
  309    IF(RLIM_T STREQUAL 4)
  310       SET(RLIM_STRING "%d")
  311    ELSEIF(RLIM_T STREQUAL 8)
  312       SET(RLIM_STRING "%lli")
  313    ELSE(RLIM_T STREQUAL 4)
  314       MESSAGE("Unknown rlim_t size")
  315    ENDIF(RLIM_T STREQUAL 4)
  316 #ELSE(HAVE_RLIM_T)
  317 #   MESSAGE("Cannot detect the size of your system's rlim_t type")
  318 ENDIF(HAVE_RLIM_T)
  319 
  320 CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
  321 IF(NOT HAVE_MKSTEMP)
  322    # MingW provide mkstemps in libiberty but doesn't declare it in any header file
  323    FIND_LIBRARY(IBERTY_LIB NAMES iberty DOC "The library of mingw containing mkstemps")
  324    IF(IBERTY_LIB)
  325       TARGET_LINK_LIBRARIES(sarg iberty)
  326    ENDIF(IBERTY_LIB)
  327 ENDIF(NOT HAVE_MKSTEMP)
  328 
  329 # Gettext and friends
  330 IF(NOT HAVE_LC_MESSAGES)
  331    SET(FILES)
  332    IF(HAVE_LOCALE_H)
  333       LIST(APPEND FILES "locale.h")
  334    ENDIF(HAVE_LOCALE_H)
  335    IF(HAVE_LIBINTL_H)
  336       LIST(APPEND FILES "libintl.h")
  337    ENDIF(HAVE_LIBINTL_H)
  338    LIST(LENGTH FILES NFILES)
  339    IF(NFILES GREATER 0)
  340       CHECK_SYMBOL_EXISTS(LC_MESSAGES "${FILES}" HAVE_LC_MESSAGES)
  341    ENDIF(NFILES GREATER 0)
  342 ENDIF(NOT HAVE_LC_MESSAGES)
  343 
  344 # System particularities
  345 IF(CMAKE_SYSTEM_NAME STREQUAL "solaris")
  346    TARGET_LINK_LIBRARIES(sarg socket nsl)
  347    #SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_DEFINITIONS="-DSOLARIS ${COMPILE_DEFINITIONS}")
  348    ADD_DEFINITIONS(-DSOLARIS)
  349 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "solaris")
  350 
  351 OPTION(ENABLE_EXTRA_PROTECT "Enable compile and runtime extra protections" OFF)
  352 IF(ENABLE_EXTRA_PROTECT)
  353    GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
  354    # _FORTIFY_SOURCE may have been defined by the system. It must be undefined before it is changed to the value we want.
  355    SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -fstack-protector -U _FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Werror")
  356 
  357    CHECK_C_COMPILER_FLAG("-Wformat -Werror=format-security" HAVE_WERROR_FORMAT_SECURITY)
  358    IF(HAVE_WERROR_FORMAT_SECURITY)
  359       GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
  360       SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Wformat -Werror=format-security")
  361    ENDIF(HAVE_WERROR_FORMAT_SECURITY)
  362 
  363    CHECK_C_COMPILER_FLAG("-Wempty-body" HAVE_EMPTY_BODY)
  364    IF(HAVE_EMPTY_BODY)
  365       GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
  366       SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Wempty-body")
  367    ENDIF(HAVE_EMPTY_BODY)
  368 ENDIF(ENABLE_EXTRA_PROTECT)
  369 
  370 # Compile sarg for debugging
  371 OPTION(ENABLE_DEBUG "Compile sarg with debugging symbols" OFF)
  372 IF(ENABLE_DEBUG)
  373    GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
  374    SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -g")
  375 ENDIF(ENABLE_DEBUG)
  376 
  377 # Enable double check of the data written in the reports
  378 OPTION(ENABLE_DOUBLE_CHECK_DATA "Make sarg double check the data it manipulates and output a warning if an error is found" OFF)
  379 
  380 # Save the configuration for the project
  381 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/include/config.h.in" "${CMAKE_BINARY_DIR}/config.h" @ONLY)
  382 
  383 # Installation of the project
  384 INSTALL(TARGETS sarg DESTINATION "${BINDIR}")
  385 INSTALL(FILES sarg.conf DESTINATION "${SYSCONFDIR}" RENAME sarg.conf.exemple)
  386 INSTALL(FILES exclude_codes user_limit_block css.tpl DESTINATION "${SYSCONFDIR}")
  387 INSTALL(FILES sarg.1 DESTINATION "${MANDIR}")
  388 INSTALL(DIRECTORY images/ DESTINATION "${IMAGEDIR}" PATTERN ".svn" EXCLUDE)
  389 INSTALL(DIRECTORY fonts/ DESTINATION "${FONTDIR}" FILES_MATCHING PATTERN "*.ttf" PATTERN ".svn" EXCLUDE)
  390 INSTALL(DIRECTORY sarg-php/ DESTINATION "${SARGPHPDIR}" PATTERN ".svn" EXCLUDE)
  391 
  392 # Package creation
  393 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Squid Analysis Report Generator")
  394 SET(CPACK_PACKAGE_VERSION_MAJOR "${sarg_VERSION}")
  395 SET(CPACK_PACKAGE_VERSION_MINOR "${sarg_REVISION}")
  396 SET(CPACK_PACKAGE_VERSION_PATCH "${sarg_BUILD}")
  397 SET(CPACK_GENERATOR TGZ)
  398 SET(CPACK_SOURCE_GENERATOR TGZ)
  399 SET(CPACK_SOURCE_IGNORE_FILES "/.git/" "/debian/" "/html/" "Makefile$" "config\\\\.log$" "config\\\\.status$" ".*~$" "\\\\.o$")
  400 INCLUDE(CPack)