Update pingcheck to work with cmake 3.28
[pingcheck] / CMakeLists.txt
index e08a828..24d4d58 100644 (file)
@@ -1,11 +1,48 @@
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required(VERSION 3.28 FATAL_ERROR)
 
-project( pinger CXX )
+# project: definitions
+project(pingcheck)
+set(VERSION 0.8)
+set(VERSION_REVISION 0)
+set(TARGET ${PROJECT_NAME})
 
-# set the directory where the executable will be placed
-set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
+# cmake: build options
+set(CMAKE_COLOR_MAKEFILE ON)
 
-# set the directory where the make install places the executable
-#set( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR} )
+# compiler: add definitions and arguments to the compiler
+add_definitions(
+    -DVERSION_STRING=${VERSION}
+    -DPROJECT_NAME=\"${PROJECT_NAME}\"
+    -DVERSION_REVISION_STRING=${VERSION_REVISION}
+)
 
-add_subdirectory( src )
+# package: package information
+set(CPACK_PACKAGE_VERSION ${VERSION})
+set(CPACK_PACKAGE_CONTACT "Intra2net AG")
+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}")
+
+# "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)
+
+# cmake: build the test cases
+add_subdirectory(test)
+
+include(CPack)