{"id":888,"date":"2022-08-30T15:08:51","date_gmt":"2022-08-30T15:08:51","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/set_target_properties-called-with-incorrect-number-of-arguments-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:08:51","modified_gmt":"2022-08-30T15:08:51","slug":"set_target_properties-called-with-incorrect-number-of-arguments-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/set_target_properties-called-with-incorrect-number-of-arguments-collection-of-common-programming-errors\/","title":{"rendered":"set_target_properties called with incorrect number of arguments?-Collection of common programming errors"},"content":{"rendered":"<p>Here is my simple CMakeLists.txt file:<\/p>\n<pre><code>include_directories (${CMAKE_SOURCE_DIR}\/common)\nfind_package(Threads)\n\nadd_library (libusbmuxd SHARED libusbmuxd.c sock_stuff.c ${CMAKE_SOURCE_DIR}\/common\/utils.c)\nfind_library (PTHREAD pthread)\ntarget_link_libraries (libusbmuxd ${CMAKE_THREAD_LIBS_INIT})\n\n# 'lib' is a UNIXism, the proper CMake target is usbmuxd\n# But we can't use that due to the conflict with the usbmuxd daemon,\n# so instead change the library output base name to usbmuxd here\nset_target_properties(libusbmuxd PROPERTIES OUTPUT_NAME usbmuxd)\nset_target_properties(libusbmuxd PROPERTIES VERSION ${LIBUSBMUXD_VERSION})\nset_target_properties(libusbmuxd PROPERTIES SOVERSION ${LIBUSBMUXD_SOVERSION})\n\ninstall(TARGETS libusbmuxd\n    ARCHIVE DESTINATION lib${LIB_SUFFIX}\n    LIBRARY DESTINATION lib${LIB_SUFFIX}\n)\ninstall(FILES usbmuxd.h usbmuxd-proto.h DESTINATION include)\n<\/code><\/pre>\n<p>This gives me an error:<br \/>\n<code>CMake error at CMakeLists.txt:12 (set_target_properties):<br \/>\nset_target_properties called with incorrect number of arguments<\/code><\/p>\n<p><code>CMake error at CMakeLists.txt:13 (set_target_properties):<br \/>\nset_target_properties called with incorrect number of arguments<\/code> Those are the second and third set_target_properties. The first set_target_properties never had that problem?<br \/>\n(If you haven&#8217;t realized already, I&#8217;m trying to build usbmuxd-1.0.4)<\/p>\n<ol>\n<li>\n<p>The format of SET_TARGET_PROPERTIES is:<\/p>\n<pre><code>SET_TARGET_PROPERTIES(\n    target1 target2 ... targetM\n    PROPERTIES \n    prop1 val1 prop2 val2 ... propN valN\n)\n<\/code><\/pre>\n<p>The reason for your problem is that your variables LIBUSBMUXD_VERSION and LIBUSBMUXD_SOVERSION are undefined, and so the syntax of your command is:<\/p>\n<pre><code>SET_TARGET_PROPERTIES(target PROPERTIES name)\n<\/code><\/pre>\n<p>Instead of:<\/p>\n<pre><code>SET_TARGET_PROPERTIES(target PROPERTIES name value)\n<\/code><\/pre>\n<p>To fix this, try quoting the variables; using &#8220;${LIBUSBMUXD_SOVERSION}&#8221; should ensure that it takes on the value of the empty string even if the variable is undefined, thereby adhering to the syntax.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:54:52. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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}) # &#8216;lib&#8217; is a UNIXism, the proper CMake target is usbmuxd # But we can&#8217;t use that due to the conflict with the usbmuxd daemon, # so instead change the library output base name [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-888","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=888"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/888\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}