Skip to content
Gökhan Simsek edited this page Aug 1, 2016 · 4 revisions

  1. General Info/Rules
    1. Relative Path Rule
  2. Package for Linux
    1. Debian package
    2. RPM package
  3. Package for Mac OS X
    1. DMG package
  4. Package for Windows
    1. NSIS package

1. General Info/Rules

i. Relative Path Rule

Use relative paths instead of absoute paths for install "DESTINATION" in cmake.

Example: In the example below, using absolute path like " DESTINATION ${CMAKE_INSTALL_PREFIX} " will result with error in packing stage on windows and worse on MAC files will not be copied/installed (without warning and error !!)

Good: Use bin_dir is ".", it is relative directory

set(bin_dir .)
# Install OpenSSL dynamic lib files
if(SYSTEM_WINDOWS)
    install(
        FILES 
        "${OpenSSL_DIR}/out32dll/ssleay32.dll"
        "${OpenSSL_DIR}/out32dll/libeay32.dll"
        DESTINATION ${bin_dir})
        ...

2. Package for Linux

Debian package

cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DCPACK_GENERATOR=DEB 
cpack 
sh ./fixup_deb.sh 

RPM package

cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DCPACK_GENERATOR=RPM 
cpack

Package for Mac OS X

DMG package

cmake .. -DCMAKE_BUILD_TYPE=RELEASE 
cpack

3. Package for Windows

NSIS package

cmake .. -DCMAKE_BUILD_TYPE=RELEASE 
cpack