set_target_properties called with incorrect number of arguments?
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.
Mohit Deshpande
I am a researcher at The Ohio State University in the field of computer vision and machine learning. I have worked as a mobile apps instructor for Zenva and current work as a writer for Zenva in machine learning.
Updated on July 09, 2022Comments
-
Mohit Deshpande 12 monthsHere 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 argumentsCMake error at CMakeLists.txt:13 (set_target_properties):Those are the second and third set_target_properties. The first set_target_properties never had that problem?
set_target_properties called with incorrect number of arguments
(If you haven't realized already, I'm trying to build usbmuxd-1.0.4) -
ollo over 10 yearsThe last sentence is exactly what solved my problem. unfortunately i can upvote your answer only once. Thanks! -
Royi over 5 yearsCan I put a list as value? For instant, how would you set theLINKER_FLAGwith multiple flags? -
Royi almost 5 yearsHow can I define empty variable?