0

While running a project which used to work fine, I got the following error:

CMake Error at tacopie/CMakeLists.txt:146 (install):
  install Library TARGETS given no DESTINATION!

I'm not a CMake expert, but at first glance, The TARGETS statement looks like it has a destination:

install(TARGETS ${PROJECT_NAME} EXPORT ${EXPORT_TARGET_NAME}
  LIBRARY 
  RESOURCE DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

This all fell out from an upgrade with a needed fix with the modernization of CMake for the "Tacopie" library, documented here. https://github.com/cpp-redis/cpp_redis/issues/105

However, adding the fixes mentioned in that issue/thread did not fix my problem.

Without forking this project, which seems unneeded, I can't change the scripts involved. I don't want to limit the commit to an earlier commit as there are fixes in the current main branch we need.

Note: There are two other similar questions: CMAKE install TARGETS given no ARCHIVE DESTINATION

CMake Error: TARGETS given no LIBRARY DESTINATION for shared library target.

These answers do not answer this question for the following reasons:

  1. The error message initially given is different.
  2. One of the answers does mention this exact error message "CMake Error: install Library TARGETS given no DESTINATION", but only if you scroll to the right, in an embedded code block. Someone searching for the error message we got wouldn't read every answer and every code block to see if the question was the same, especially given the initial description/question was different. I didn't notice it at first until this question was marked as a duplicate. Just to make search easier, I therefore see this as a new, non-duplicate question. Just because the same answer 'bro, upgrade' applies to two questions does not mean those questions are duplicated.
  3. Another answer, helpfully from Tsyvarev, does imply (but not state) an upgrade would help. Knowing the background helps, thank you. I don't know Cmake that well, but I thought this answer didn't 100% apply as the code in question does have a DESTINATION (it's a DLL/LIB). He also mentions modifying the CMake script, and we cannot do this (it's another project/library that's brought in via git). See: https://stackoverflow.com/a/74759795/5937168

The fixes in those threads are different; they all mention modifying the cmake script (including the answer that implies an upgrade), so I thought it would NOT be a duplicate and decided to document this question.

Search for my error string, from a DLL/Lib project with an older version of CMake would stumble on this error first, as it's an exact hit.

J. Gwinner
  • 931
  • 10
  • 15
  • "... the fixes in those threads are slightly different, so I thought it would be important to document this problem." - If you want to provide **another solution** for already **known problem**, then there is no needs to create new Question/Answer pair: Just add your answer to the existed question. I have described your case in [that answer](https://stackoverflow.com/a/74759795/3440745). – Tsyvarev Dec 11 '22 at 10:00
  • The error message was different. The fixes were different, implying a different root cause. Does that still count as a duplicate question? (honestly asking). Maybe an expert CMAKE person sees two different errors being the same, but it wasn't obvious to me. What do you suggest? – J. Gwinner Dec 12 '22 at 01:44
  • "The error message was different" - Actually, while the duplicate question post specifies a single error message. its answers describe different variations of that message. "The fixes were different, implying a different root cause." - The information given in your **question post** is insufficient for claim different "root cause". E.g like in the duplicate question, you don't specify (in the question post) what kind of target is installed. As for solutions.. are you sure that updating to CMake 3.14 is not sufficient, as stated in [my answer](https://stackoverflow.com/a/74759795/3440745)?. – Tsyvarev Dec 12 '22 at 09:09
  • The error string we got wasn't ever mentioned in that question, except if you scrolled to the right in a code block in one of the answers - and not even yours. So it wasn't clear that this was a duplicate, unless I searched for semi-related errors and then read every answer, and decided that another answer's error string that was a match (and that answer didn't mention upgrade) might also apply to your answer. Does that make sense to you? As opposed to getting an exact hit on an exact error string, then a clear suggestion to do an update. Your answer mentions modifying cmake; ours is R/O. – J. Gwinner Dec 14 '22 at 21:01
  • "Your answer mentions modifying cmake" - Eh? My answer says nothing about **modifying** CMake. It tells only that new CMake version (3.14) won't emit such message in some cases, so **updating** CMake to at least given version will solve the problem. You answer also tells about updating CMake, but to much higher version (3.25). BTW, exactly such crucial change of CMake version could cause additional issues mentioned in your answer. – Tsyvarev Dec 14 '22 at 21:51
  • "... but I thought this answer didn't 100% apply as the code in question does have a DESTINATION (it's a DLL/LIB)" - Your code has DESTINATION option only for the RESOURCE artifacts. But it misses that option for LIBRARY artifact. Exactly that problem is noted in the error message, and exactly that problem is described in the duplicate question. "I didn't notice it at first until this question was marked as a duplicate. Just to make search easier..." - A signpost is the exact purpose of the duplicate mark. If you think that a duplicate is bad, then see https://stackoverflow.com/help/duplicates – Tsyvarev Dec 14 '22 at 22:09
  • '"Your answer mentions modifying cmake" - Eh?' You said: Alternatively, one could include module GNUInstallDirs, and set corresponding CMAKE_INSTALL_ variable. No, I can't, as the CMake configuration (not cmake it self obviously) is a project from a different repo. So modifying [the] CMake [configuration files] isn't an option for us. "so updating CMake to at least given version will solve the problem." Your answer doesn't actually say this. It's implied, however. How does one notice this when the question doesn't fit the question was asking? – J. Gwinner Dec 15 '22 at 01:35
  • And as far as the link to the docs go, I did read it. My point is exactly contained there: "This does not mean that every duplicate will immediately be closed; we love (some) dupes. There are many ways to ask the same question, and a user might not be able to find the answer if they're asking it a different way." – J. Gwinner Dec 15 '22 at 01:35
  • This is the exactly the point I was making. Neither I, nor another senior dev, found a question matching what we perceived our question was. So you're saying I'm supposed to read error strings in other answers that scroll off the page? That's a lot of work. Can you address why this makes sense to you? – J. Gwinner Dec 15 '22 at 01:37

1 Answers1

0

Documenting my own solution: The fix in this case was to simply update CMake; from version 3.13.3 to 3.25.1 or really any newer version.

J. Gwinner
  • 931
  • 10
  • 15