Reputation: 96832
Behold the following fairly trivial CMake file:
cmake_minimum_required(VERSION 3.7)
add_library(libdice SHARED lib.cpp)
set_target_properties(libdice PROPERTIES
PREFIX ""
OUTPUT_NAME "Dice"
PUBLIC_HEADER "lib.h"
)
install(TARGETS libdice
RUNTIME DESTINATION "lib"
LIBRARY DESTINATION "lib"
PUBLIC_HEADER DESTINATION "include"
COMPONENT sdk
)
set(CPACK_PACKAGE_NAME "Dice SDK")
set(CPACK_GENERATOR "NSIS")
include(CPack)
cpack_add_component(sdk)
With this lib.h
:
#pragma once
int sides_of_a_dice();
And lib.cpp
:
int sides_of_a_dice()
{
return 6;
}
So if I nmake package
for this on Windows it for some reason puts Dice.dll
in an Unspecified
component, even thought the component is clearly specified. Even weirder, the public headers (lib.h
) correctly go in the sdk
component.
CPack: Create package using NSIS
CPack: Install projects
CPack: - Run preinstall target for: Project
CPack: - Install project: Project
CPack: - Install component: Unspecified <- Why??!
CPack: - Install component: sdk
CPack: Create package
What is going on?
Upvotes: 1
Views: 976
Reputation: 66089
According to documentation for install command, every specification of file's type (like RUNTIME, LIBRARY or PUBLIC_HEADER) starts its own install clause, to which all other options are applied.
That is, option COMPONENT sdk
is applied only to file's type PUBLIC_HEADER
.
Other files (RUNTIME
, LIBRARY
) have component option unspecified.
Upvotes: 2