Hello,
I try to solve generating 3rd-party .dll files to the executable folder or install folder with install(TARGETS). The install works only for RUNTIME but not for LIBRARY others. Here is my code:
After compilation of the project, a folder named install comes out correctly under the ${CMAKE_INSTALL_PATH} and also a subdirectory bin shown there with an executable file inside but nothing else was found.
You wouldn’t normally add the ${CMAKE_INSTALL_PATH} prefix to the various destinations.
There isn’t enough information here to know what the cause could be. Please post a complete, minimal project which someone else can use to reproduce the problem on their machine. Cut down your real project as far as you can, removing anything that isn’t relevant to the issue you are seeing.
This modification gives a bin folder and an include folder in the “install” one. It still failed to generate lib folder and anything related to that. The project is very simple. The tree structure looks like
It is the same level for source, build and install.
In CMakeLists.txt, there are few libraries and can be found correctly during configuration of cmake-gui. OpenCV is shown here as an example
The only target you are installing is an executable. If you are expecting the OpenCV libraries to be installed as well, you have to install those yourself. I’d recommend you checkout the CMake docs for the file(GET_RUNTIME_DEPENDENCIES) command for that.
This would have been easier if you had provided a complete CMakeLists.txt rather than making others piece one together from fragments.