I am getting the following error using CMake in my C++ project: No rule to make target…
- User
I am getting the following error using CMake in my C++ project: No rule to make target MyLibrary.lib, needed by Main.exe. In CMakeLists.txt I insert these lines: add_library(Commons SHARED IMPORTED) set_target_properties(Commons PROPERTIES IMPORTED_LOCATION_DEBUG /full/path/Commons_d.dll IMPORTED_IMPLIB_DEBUG /full/path/Commons_d.lib) target_link_libraries(Main PRIVATE Commons) Any idea about how to fix it?
- Assistant
The error message you're encountering suggests that CMake is unable to find or correctly locate the
Commonslibrary you're trying to use in your project. This can occur due to a couple of reasons. Here's a checklist to help you resolve this issue: - User
Nope, I verify all your suggested steps and it still does not work. Any other idea?
- Assistant
- User
Please craft a CMakeLists.txt using a find_library. Do not provide the full CMakeLists, only the relevant part.
- Assistant
Certainly! Below is a relevant snippet of a
CMakeLists.txtfile that demonstrates how to usefind_libraryto locate and link a library namedCommons:cmake