2

I am using Cmake with Cpack to create linux packages. I install my executable in /bin/MyProgram; in order to work properly, the executable needs to have access to an external file (an xml schema). I would like Cpack to generate a package that will install that file in a specific location (e.g. /usr/share/MyProgram) other than the one where the executable is stored.

Thank you very much!

2 Answers 2

1

You want to use INSTALL(FILES ) like this:

install(FILES files... DESTINATION <dir>
      [PERMISSIONS permissions...]
      [CONFIGURATIONS [Debug|Release|...]]
      [COMPONENT <component>]
      [RENAME <name>] [OPTIONAL])

You can read more about the INSTALL command in the CMake documentation.

0
0

You need to use COMPONENT for this.

install(
    DIRECTORY ${CMAKE_SOURCE_DIR}/Assets
    DESTINATION "Library/Application Support/${PROJECT_NAME}/"
    COMPONENT ASSETS
)

set(CPACK_MONOLITHIC_INSTALL OFF)
set(CPACK_COMPONENTS_ALL ASSETS)

Not the answer you're looking for? Browse other questions tagged or ask your own question.