summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/cpack/install_license_and_readme.cmake20
-rw-r--r--cmake/cpack/install_version.cmake9
-rwxr-xr-xcmake/scripts/test.sh23
3 files changed, 52 insertions, 0 deletions
diff --git a/cmake/cpack/install_license_and_readme.cmake b/cmake/cpack/install_license_and_readme.cmake
new file mode 100644
index 0000000..c41bc46
--- /dev/null
+++ b/cmake/cpack/install_license_and_readme.cmake
@@ -0,0 +1,20 @@
+# SPDX-FileCopyrightText: 2024 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(NOT CPACK_SOURCE_INSTALLED_DIRECTORIES)
+ if(CPACK_SYSTEM_NAME MATCHES "^win")
+ set(_license "LICENSE.txt")
+ else()
+ set(_license "LICENSE")
+ endif()
+
+ file(COPY_FILE
+ "${CPACK_RESOURCE_FILE_LICENSE}"
+ "${CMAKE_INSTALL_PREFIX}/${_license}"
+ )
+
+ file(COPY_FILE
+ "${CPACK_RESOURCE_FILE_README}"
+ "${CMAKE_INSTALL_PREFIX}/README.md"
+ )
+endif()
diff --git a/cmake/cpack/install_version.cmake b/cmake/cpack/install_version.cmake
new file mode 100644
index 0000000..c37b786
--- /dev/null
+++ b/cmake/cpack/install_version.cmake
@@ -0,0 +1,9 @@
+# SPDX-FileCopyrightText: 2024 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(CPACK_SOURCE_INSTALLED_DIRECTORIES)
+ file(WRITE
+ "${CMAKE_INSTALL_PREFIX}/version.cmake"
+ "set(BLOGC_VERSION \"${CPACK_PACKAGE_VERSION}\")"
+ )
+endif()
diff --git a/cmake/scripts/test.sh b/cmake/scripts/test.sh
new file mode 100755
index 0000000..cbf0de4
--- /dev/null
+++ b/cmake/scripts/test.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# SPDX-FileCopyrightText: 2024 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+# SPDX-License-Identifier: BSD-3-Clause
+
+set -Eeuo pipefail
+
+if [[ "${VARIANT:-}" = "memcheck" ]]; then
+ export VALGRIND=valgrind
+ export TESTS_ENVIRONMENT="
+ ${VALGRIND} \
+ --tool=memcheck \
+ --leak-check=full \
+ --leak-resolution=high \
+ --num-callers=20 \
+ --error-exitcode=1 \
+ --show-possibly-lost=no"
+fi
+
+if [[ "${1}" == *.sh ]]; then
+ exec "${@}"
+else
+ exec ${TESTS_ENVIRONMENT:-} "${@}"
+fi