diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1138790 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +CMakeFiles/ +cmake_install.cmake +CMakeCache.txt +cookiebot +cookiebot_conf.h +Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 252ddbe..61ebde3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,37 @@ cmake_minimum_required (VERSION 2.6) project(cookiebot) set (cookiebot_VERSION_MAJOR 0) set (cookiebot_VERSION_MINOR 0) -option (MOD_GZIP "Enable Module compression with gzip" ON) -option (MOD_BZ2 "Enable Module compression with bz2" ON) -option (MOD_XZ "Enable Module compression with xz/lzma" ON) +find_package (ZLIB) +find_package (BZip2) +find_program (XZ_FOUND xz) +if (ZLIB_FOUND) + option (MOD_GZIP "Enable Module compression with gzip" ON) +else (!ZLIB_FOUND) + option (MOD_GZIP "Enable Module compression with gzip" OFF) +endif (ZLIB_FOUND) +if (BZIP2_FOUND) + option (MOD_BZ2 "Enable Module compression with bz2" ON) +else (!BZIP2_FOUND) + option (MOD_BZ2 "Enable Module compression with bz2" OFF) +endif (BZIP2_FOUND) +if (XZ_FOUND) + option (MOD_XZ "Enable Module compression with xz/lzma" ON) +else (!XZ_FOUND) + option (MOD_XZ "Enable Module compression with xz/lzma" OFF) +endif (XZ_FOUND) configure_file ( "${PROJECT_SOURCE_DIR}/cookiebot_conf.h.in" "${PROJECT_BINARY_DIR}/cookiebot_conf.h" ) include_directories("${PROJECT_BINARY_DIR}") +if (MOD_GZIP) + set(EXTRA_LIBS ${EXTRA_LIBS} z) +endif (MOD_GZIP) +if (MOD_BZ2) + set(EXTRA_LIBS ${EXTRA_LIBS} bz2) +endif (MOD_BZ2) +if (MOD_XZ) + set(EXTRA_LIBS ${EXTRA_LIBS} lzma) +endif (MOD_XZ) add_executable(cookiebot cookiebot.cpp) +target_link_libraries (cookiebot ${EXTRA_LIBS}) diff --git a/Makefile b/Makefile deleted file mode 100644 index 843383a..0000000 --- a/Makefile +++ /dev/null @@ -1,178 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.4 - -# Default target executed when no arguments are given to make. -default_target: all - -.PHONY : default_target - -# Allow only one "make -f Makefile2" at a time, but pass parallelism. -.NOTPARALLEL: - - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - - -# A target that is always out of date. -cmake_force: - -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/morten/cookiebot - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/morten/cookiebot - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." - /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache - -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache - -.PHONY : rebuild_cache/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /home/morten/cookiebot/CMakeFiles /home/morten/cookiebot/CMakeFiles/progress.marks - $(MAKE) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/morten/cookiebot/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean - -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -#============================================================================= -# Target rules for targets named cookiebot - -# Build rule for target. -cookiebot: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 cookiebot -.PHONY : cookiebot - -# fast build rule for target. -cookiebot/fast: - $(MAKE) -f CMakeFiles/cookiebot.dir/build.make CMakeFiles/cookiebot.dir/build -.PHONY : cookiebot/fast - -cookiebot.o: cookiebot.cpp.o - -.PHONY : cookiebot.o - -# target to build an object file -cookiebot.cpp.o: - $(MAKE) -f CMakeFiles/cookiebot.dir/build.make CMakeFiles/cookiebot.dir/cookiebot.cpp.o -.PHONY : cookiebot.cpp.o - -cookiebot.i: cookiebot.cpp.i - -.PHONY : cookiebot.i - -# target to preprocess a source file -cookiebot.cpp.i: - $(MAKE) -f CMakeFiles/cookiebot.dir/build.make CMakeFiles/cookiebot.dir/cookiebot.cpp.i -.PHONY : cookiebot.cpp.i - -cookiebot.s: cookiebot.cpp.s - -.PHONY : cookiebot.s - -# target to generate assembly for a file -cookiebot.cpp.s: - $(MAKE) -f CMakeFiles/cookiebot.dir/build.make CMakeFiles/cookiebot.dir/cookiebot.cpp.s -.PHONY : cookiebot.cpp.s - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... rebuild_cache" - @echo "... cookiebot" - @echo "... cookiebot.o" - @echo "... cookiebot.i" - @echo "... cookiebot.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system -