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:
- The error message initially given is different.
- 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.
- 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.