Skip to content

Commit 2466b14

Browse files
committed
cmake: add cpack config
1 parent e44cdd2 commit 2466b14

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,27 @@ endif()
180180
if(SLANG_INCLUDE_INSTALL)
181181
include(cmake/install-rules.cmake)
182182
endif()
183+
184+
set(gitignore ${PROJECT_SOURCE_DIR}/.gitignore)
185+
if(SLANG_MASTER_PROJECT AND EXISTS ${gitignore})
186+
# Get the list of ignored files from .gitignore.
187+
file(STRINGS ${gitignore} lines)
188+
list(REMOVE_ITEM lines /doc/html)
189+
foreach(line ${lines})
190+
string(REPLACE "/" "" line "${line}")
191+
string(REPLACE "." "[.]" line "${line}")
192+
string(REPLACE "*" ".*" line "${line}")
193+
set(ignored_files ${ignored_files} "${line}$" "${line}/")
194+
endforeach()
195+
set(ignored_files ${ignored_files} /.git)
196+
197+
set(CPACK_PACKAGE_NAME slang)
198+
set(CPACK_PACKAGE_INSTALL_DIRECTORY slang)
199+
set(CPACK_PACKAGE_VENDOR "Michael Popoloski")
200+
set(CPACK_SOURCE_GENERATOR ZIP)
201+
set(CPACK_VERBATIM_VARIABLES YES)
202+
set(CPACK_SOURCE_IGNORE_FILES ${ignored_files})
203+
set(CPACK_SOURCE_PACKAGE_FILE_NAME slang-${SLANG_VERSION_STRING})
204+
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
205+
include(CPack)
206+
endif()

0 commit comments

Comments
 (0)