Update pingcheck to work with cmake 3.28
[pingcheck] / CMakeLists.txt
index 124e950..24d4d58 100644 (file)
@@ -1,31 +1,19 @@
-# IMPORTANT: Do not add whitespaces between cmake commands! This will break
-# the package build!
-# Do set(CONTENTS) instead of set( CONTENTS ) or set (CONTENTS)
-
-# cmake: required version
-cmake_minimum_required (VERSION 2.6)
-
-# cmake: set the directory where the executable will be placed
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
-# cmake: set the directory where the make install places the executable
-set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
+cmake_minimum_required(VERSION 3.28 FATAL_ERROR)
 
 # project: definitions
-project(libpingcheck)
-set(VERSION 0.1)
+project(pingcheck)
+set(VERSION 0.8)
+set(VERSION_REVISION 0)
 set(TARGET ${PROJECT_NAME})
 
-# compiler: disable the full compiler output
-set(CMAKE_VERBOSE_MAKEFILE OFF)
-
-# compiler: build type
-set(CMAKE_BUILD_TYPE Debug)
+# cmake: build options
+set(CMAKE_COLOR_MAKEFILE ON)
 
 # compiler: add definitions and arguments to the compiler
 add_definitions(
-    -Werror -Wall -Wextra -Weffc++ -O2 -DVERSION_STRING=${VERSION}
+    -DVERSION_STRING=${VERSION}
     -DPROJECT_NAME=\"${PROJECT_NAME}\"
+    -DVERSION_REVISION_STRING=${VERSION_REVISION}
 )
 
 # package: package information
@@ -35,10 +23,26 @@ set(CPACK_PACKAGE_DESCRIPTION ${TARGET})
 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Pingcheck")
 set(CPACK_SOURCE_GENERATOR TGZ)
 set(CPACK_SOURCE_IGNORE_FILES "\\\\.git;build;build-rpm")
+set(CPACK_SOURCE_IGNORE_FILES
+    "~$"
+    "\\\\.git"
+    "\\\\.kdev4"
+    "build"
+    "build-rpm"
+)
 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${TARGET}-${VERSION}")
 
-# build the application in the source directory
+# "make dist" target
+set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${VERSION})
+add_custom_target(dist
+    COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
+            | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+
+# cmake: build the application in the source directory
 add_subdirectory(src)
 
-# package: ???
+# cmake: build the test cases
+add_subdirectory(test)
+
 include(CPack)