0

I want to distribute a gzipped tarball containing a program binary. No problem making a package containing the binary plus additional script/man files because these are files I install with CMake INSTALL command during a source installation.

While the need for such a functionality seems quite obvious to me, I didn't find a way to include text files in CPack tarball packages. Here is an example of the final tarball I'd like to get:

myprogram-1.0.0rc-Darwin-i386/
├── LICENSE <- not installed by CMake
├── INSTALL <- not installed by CMake
├── README  <- not installed by CMake
├── bin
│   └── myprogram
└── share
    └── myprogram
        └── man
            └── man1
                └── myprogram.1

Any help would be very much appreciated.

Cheers

1 Answers1

0

You can use install too with FILES or DIRECTORY option.

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.txt DESTINATION .)
opatry
  • 131
  • 4
  • Thanks for your answer. Unfortunately, it won't do it because this will install the README file even when doing a make install. –  Feb 04 '14 at 10:05
  • In the end, what's the way to use this command only if "make package" is called? –  Feb 04 '14 at 13:08
  • `install` commands are only called when invoking `make package` or `cpack` (which is the way I recommend since for some Generators, there is no makefile but still a packaging step). I didn't noticed the `make install` step you mentioned… maybe you can add an extra option "PACKAGING" and only set it to `ON` when you want effective packaging? From my point of view, `make install` and `cpack`/`make package` shouldn't be invoked at the same time. – opatry Feb 04 '14 at 13:11
  • For the "PACKAGING" boolean, that's the workaround I came up to but it's no very satisfying because you can still invoke `make package` while PACKAGING is to OFF and generate a wrong package. Besides, I'm not sure I understand you but `make install` and `make package` are not invoked at the same time (I do not invoke `make install package` if that's what you mean). But I'd like CMake to include the README when I'm doing a package and not when I'm installing it (operations that can be done with several week of interval). –  Feb 04 '14 at 13:30