SET_TARGET_PROPERTIES(
wtdbo
PROPERTIES
VERSION ${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}
SOVERSION ${WTDBO_SOVERSION}
DEBUG_POSTFIX "d"
)
The error is:
错误的是:
CMake Error at src/Wt/Dbo/CMakeLists.txt:18 (SET_TARGET_PROPERTIES): set_target_properties called with incorrect number of arguments
CMake错误在src / Wt / Dbo / CMakeLists。txt:18 (SET_TARGET_PROPERTIES): SET_TARGET_PROPERTIES调用不正确的参数数量。
If I remove it it configures just fine.
Any idea why?
如果我移除它,它的配置就很好。知道为什么吗?
Thanks,
Omer
谢谢你,俄梅珥
2 个解决方案
#1
3
Are you sure you have the variables set correctly? I've checked with this CMakeLists.txt file, and it works correctly:
你确定你有正确的变量吗?我已经检查过了CMakeLists。txt文件,它工作正常:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(test CXX)
ADD_LIBRARY(wtdbo SHARED test.cc)
SET(WTDBO_SOVERSION 1)
SET(VERSION_SERIES 1)
SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 0)
SET_TARGET_PROPERTIES(
wtdbo
PROPERTIES
VERSION ${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}
SOVERSION ${WTDBO_SOVERSION}
DEBUG_POSTFIX "d"
)
However, if I comment out the SET(WTDBO_SOVERSION 1)
line I get the same error message as you do. The help for set_target_properties
is as follows, so you are definitely doing the right thing:
但是,如果我注释掉SET(WTDBO_SOVERSION 1),就会得到与您相同的错误消息。set_target_properties的帮助如下,所以您肯定做了正确的事情:
Targets can have properties that affect how they are built.
目标可以具有影响其构建方式的属性。
set_target_properties(target1 target2 ... PROPERTIES prop1 value1 prop2 value2 ...)
Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it later with the
GET_TARGET_PROPERTY
command.在目标上设置属性。命令的语法是列出要更改的所有文件,然后提供要设置的值。您可以使用您想要的任何道具值对,然后使用GET_TARGET_PROPERTY命令提取它。
#2
7
Remember that this is a macro, so symbols are replaced before being evaluated. This means that symbols that are empty strings will be replaced to nothing before being evaluated. Thus, if WTDBO_SOVERSION is "" then
请记住,这是一个宏,所以在进行评估之前,将替换符号。这意味着在被评估之前,空字符串的符号将被替换为任何东西。因此,如果WTDBO_SOVERSION是“”。
SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION ${WTDBO_SOVERSION})
would become
将成为
SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION)
and this would trigger the error. If empty strings are valid for your purpose then surround the symbol in quotes. e.g.
这会引发错误。如果空字符串对您的目的有效,那么在引号中包围符号。如。
SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION "${WTDBO_SOVERSION}")
#1
3
Are you sure you have the variables set correctly? I've checked with this CMakeLists.txt file, and it works correctly:
你确定你有正确的变量吗?我已经检查过了CMakeLists。txt文件,它工作正常:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(test CXX)
ADD_LIBRARY(wtdbo SHARED test.cc)
SET(WTDBO_SOVERSION 1)
SET(VERSION_SERIES 1)
SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 0)
SET_TARGET_PROPERTIES(
wtdbo
PROPERTIES
VERSION ${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}
SOVERSION ${WTDBO_SOVERSION}
DEBUG_POSTFIX "d"
)
However, if I comment out the SET(WTDBO_SOVERSION 1)
line I get the same error message as you do. The help for set_target_properties
is as follows, so you are definitely doing the right thing:
但是,如果我注释掉SET(WTDBO_SOVERSION 1),就会得到与您相同的错误消息。set_target_properties的帮助如下,所以您肯定做了正确的事情:
Targets can have properties that affect how they are built.
目标可以具有影响其构建方式的属性。
set_target_properties(target1 target2 ... PROPERTIES prop1 value1 prop2 value2 ...)
Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it later with the
GET_TARGET_PROPERTY
command.在目标上设置属性。命令的语法是列出要更改的所有文件,然后提供要设置的值。您可以使用您想要的任何道具值对,然后使用GET_TARGET_PROPERTY命令提取它。
#2
7
Remember that this is a macro, so symbols are replaced before being evaluated. This means that symbols that are empty strings will be replaced to nothing before being evaluated. Thus, if WTDBO_SOVERSION is "" then
请记住,这是一个宏,所以在进行评估之前,将替换符号。这意味着在被评估之前,空字符串的符号将被替换为任何东西。因此,如果WTDBO_SOVERSION是“”。
SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION ${WTDBO_SOVERSION})
would become
将成为
SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION)
and this would trigger the error. If empty strings are valid for your purpose then surround the symbol in quotes. e.g.
这会引发错误。如果空字符串对您的目的有效,那么在引号中包围符号。如。
SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION "${WTDBO_SOVERSION}")