[英]CPack NSIS component is Unspecified
Behold the following fairly trivial CMake file: 看一下以下相当简单的CMake文件:
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
: 有了这个
lib.h
:
#pragma once
int sides_of_a_dice();
And lib.cpp
: 和
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. 因此,如果我在Windows上为此添加
nmake package
,则出于某种原因会将Dice.dll
放入Unspecified
组件中,甚至认为该组件已明确指定。 Even weirder, the public headers ( lib.h
) correctly go in the sdk
component. 甚至更奇怪,公共头文件(
lib.h
)正确地放入sdk
组件中。
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? 到底是怎么回事?
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. 根据install命令的文档,文件类型的每个规范 (例如RUNTIME , LIBRARY或PUBLIC_HEADER )都会启动其自己的install子句 ,所有其他选项都将应用到该子句 。
That is, option COMPONENT sdk
is applied only to file's type PUBLIC_HEADER
. 也就是说,选择
COMPONENT sdk
仅适用于文件的类型PUBLIC_HEADER
。
Other files ( RUNTIME
, LIBRARY
) have component option unspecified . 其他文件(
RUNTIME
, LIBRARY
)具有未指定的组件选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.