Reputation: 6982
I have a project for a client/server application and I have defined one installation component for each.
I use set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
in order to get two different package files when I run make package
. But I don't get different make targets for each. So in order to get the client installation package I get the server application compiled and packaged too.
Is there a simple way to get the packaging for one single component?
Upvotes: 4
Views: 2129
Reputation: 65928
CMake assumes that before installation make all
should be executed. Same assumptions are made by CPack, when it want to create package. If you want to build only targets, related to some specific component, you need to force make all
to build only those targets.
E.g., you can check cache variables which intended to be set in cmake
command line:
CMakeLists.txt:
option(SERVER_ONLY "Set if you want to build only server")
option(CLIENT_ONLY "Set if you want to build only client")
if(NOT SERVER_ONLY)
add_subdirectory(client)
endif()
if(NOT CLIENT_ONLY)
add_subdirectory(server)
endif()
So, for build and package only server component, you may use
cmake -DSERVER_ONLY=ON <source-dir>
cpack <...>
Upvotes: 6