When configuring cpack I would like to not include a few files that are in the source directory when running make package_source
, everything works fine when using CPACK_SOURCE_IGNORE_FILES
I get the correctly generated source package with the file test.cpp
not included in the resulting tar ball.
set(CPACK_SOURCE_IGNORE_FILES
/.vscode
/.vagrant
/.git
/dist
/.*build.*
/\\\\.DS_Store
test\.cpp
)
However, reading the docs for cmake I found the var CPACK_SOURCE_STRIP_FILES
. Which says "List of files in the source tree that will be stripped." So, would setting this variable be the correct way to exclude source files from the source tar ball instead of using CPACK_SOURCE_IGNORE_FILES? I have tried several variations and nothing seems to work, so either I am using it wrong or I am miss-using it or ???
set(CPACK_SOURCE_STRIP_FILES "${PROJECT_SOURCE_DIR}/src/test.cpp")
set(CPACK_SOURCE_STRIP_FILES "test.cpp")
set(CPACK_SOURCE_STRIP_FILES "src/test.cpp")
I can't find any examples of any other project using CPACK_SOURCE_STRIP_FILES so maybe I shouldn't be using it at all.
Thanks :)
The documentation is pretty confusing for someone (including me) who doesn't already know what it's referring to. I believe it's referring to the command "strip
", which is one of the GNU development tools, and is used to "discard symbols and other data from object files". I'm not sure why this would be useful for source files though; I thought source and object files are opposite sides of a coin. There is a similar cpack variable named CPACK_STRIP_FILES
, which makes much more sense.
TL;DR I'm pretty sure CPACK_SOURCE_STRIP_FILES
is not the droid you are looking for and you're right in using CPACK_SOURCE_IGNORE_FILES
.