gpt4 book ai didi

cmake - set_target_properties用错误的参数数量调用?

转载 作者:行者123 更新时间:2023-12-03 13:21:48 28 4
gpt4 key购买 nike

这是我简单的CMakeLists.txt文件:

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)

这给我一个错误: 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
这些是第二和第三set_target_properties。第一个set_target_properties从来没有这个问题?
(如果您还没有意识到,我正在尝试构建usbmuxd-1.0.4)

最佳答案

SET_TARGET_PROPERTIES的格式为:

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

问题的原因是您的变量LIBUSBMUXD_VERSION和LIBUSBMUXD_SOVERSION未定义,因此命令的语法为:
SET_TARGET_PROPERTIES(target PROPERTIES name)

代替:
SET_TARGET_PROPERTIES(target PROPERTIES name value)

要解决此问题,请尝试引用变量;使用“$ {LIBUSBMUXD_SOVERSION}”应确保即使变量未定义,它也可以采用空字符串的值,从而遵守语法。

关于cmake - set_target_properties用错误的参数数量调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3221996/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com