Update pingcheck to work with cmake 3.28
[pingcheck] / CMakeLists.txt
index 2ddab70..24d4d58 100644 (file)
@@ -1,24 +1,48 @@
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required(VERSION 3.28 FATAL_ERROR)
 
-# project definitions
-project( libpingcheck CXX )
-set( MAJOR_VERSION 0 )
-set( MINOR_VERSION 1 )
-set( VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION} )
+# 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} )
-
-# enable or disable the full compiler output
-set( CMAKE_VERBOSE_MAKEFILE OFF )
-
-# add definitions, compiler switches, etc.
+# compiler: add definitions and arguments to the compiler
 add_definitions(
-    -Werror -Wall -Wextra -Weffc++ -O2 -DVERSION_STRING=${VERSION_STRING}
+    -DVERSION_STRING=${VERSION}
+    -DPROJECT_NAME=\"${PROJECT_NAME}\"
+    -DVERSION_REVISION_STRING=${VERSION_REVISION}
+)
+
+# 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)
 
-# more build in the source folder
-add_subdirectory( src )
+include(CPack)