summaryrefslogtreecommitdiffstats
path: root/cmake/cpack/install_license_and_readme.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/cpack/install_license_and_readme.cmake')
-rw-r--r--cmake/cpack/install_license_and_readme.cmake20
1 files changed, 20 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()