开发者

set_target_properties called with incorrect number of arguments?

Here is my simple CMakeLists.txt file:

include_directories (${CMAKE_SOURCE_DIR}/common)
find_package(Threads)

add_library (libusbmuxd SHARED libusbmuxd.c sock_stuff.c ${CMAKE_SOURCE_DIR}/common/utils.c)
find_library (PTHREAD pthread)
target_link_libraries (libusbmuxd ${CMAKE_THREAD_LIBS_INIT})

# 'lib' is a UNIXism, the proper CMake target is usbmuxd
# But we can't use that due to the conflict with the usbmuxd daemon,
# so instead change the library output base name to usbmuxd here
set_target_properties(libusbmuxd PROPERTIES OUTPUT_NAME usbmuxd)
set_target_properties(libusbmuxd PROPERTIES VERSION ${LIBUSBMUXD_VERSION})
set_target_properties(libusbmuxd PROPERTIES SOVERSION ${LIBUSBMUXD_SOVERSION})

install(TARGETS libusbmuxd
    ARCHIVE DESTINATION lib${LIB_SUFFIX}
    LIBRARY DESTINATION lib${LIB_SUFFIX}
)
install(FILES usbmuxd.h usbmuxd-proto.h DESTINATION include)

This gives me an error:

CMake error at CMakeLists.txt:12 (set_target_properties):

set_target_properties called with incorrect number of arguments

CMake error at CMakeLists.txt:13 (set_target_properties):

set_target_properties called with incorrect number of arguments Those are the second and third set_target_properties. The first set_target_properties neve开发者_JAVA百科r had that problem?

(If you haven't realized already, I'm trying to build usbmuxd-1.0.4)


The format of SET_TARGET_PROPERTIES is:

SET_TARGET_PROPERTIES(
    target1 target2 ... targetM
    PROPERTIES 
    prop1 val1 prop2 val2 ... propN valN
)

The reason for your problem is that your variables LIBUSBMUXD_VERSION and LIBUSBMUXD_SOVERSION are undefined, and so the syntax of your command is:

SET_TARGET_PROPERTIES(target PROPERTIES name)

Instead of:

SET_TARGET_PROPERTIES(target PROPERTIES name value)

To fix this, try quoting the variables; using "${LIBUSBMUXD_SOVERSION}" should ensure that it takes on the value of the empty string even if the variable is undefined, thereby adhering to the syntax.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜