-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependencies handling in cmake config #1594
Comments
|
I reckon that I did not communicate clearly what my issue is. In which file do I find this line? It only sets the CMAKE_PREFIX_PATH, but I'm talking about dependencies, so anything about set_target_properties or target_link_libraries. As far as I have understood it: In the dlibConfig.cmake from my unmodified master installation (commit 61a021c), the dlib.cmake in the same folder will be called.
In that last line, the dependencies are set for the already-compiled dependency dlib. My issue, if I deploy the installation to another system, the dependencies of dlib might reside at a different place. Even as suggested above, setting the CMAKE_PREFIX_PATH, will not change the fact that hardcoded paths are set as dependencies. From my little experience in cmake 3, I expected some find_package or find_dependency in the dlibConfig.cmake and the setting of targets instead of hardcoded paths as dependency of target. Is there any rational behind not doing it that way, besides not coming around to do so far? (thank's so far for your help) |
CUDNN is not part of or distributed with dlib, so the CUDNN would need to be found again on the system where it is being imported, right? |
Exactly. I understand that dlib so far assumes that it will be always at the path where cmake found it at configuration time of dlib compilation/installation. In my case that is It most likely is a small issue for most people, since they install and use dlib at the same system. I wanted to package it and came across that problem. Is it an issue you are aware of or even have decided to do it that way? (out of curiosity) |
Yeah so the problem is that these are full paths rather than just the name of the library file so you can resolve it on the other end. I suppose the main issue is there is no FindCUDNN or FindMKL. Workaround is to sed -i 's!/path/to/prebuilts!!g' |
I think this is generally how cmake installs work. If you want to propose a change then submit a PR. Note that it must work on all platforms and not break any existing use cases. |
I think I know now why CMake works that way. Using the cmake2 way of setting variables (in the Find* files causes the hardcoded paths. I'm gonna try in the new year to submit a PR where the Find* files are defining target and properties. This I reckon should help to erase the hardcoded paths from the Config*. |
When installing dlib, I see that the exported cmake config has dependencies with hardcoded paths imprinted. This causes any other environment setting to keep the dependencies at the same place.
In my case, I have a docker where I install dlib with cudnn at /usr/libx86_64-linux-gnu.
On the system I want my dlib to deploy to, I have cudnn at /opt/cudnn-7.
Usually cmake allows to abstract from this path-hardcoded dependency by letting dlibConfig.cmake find cudnn a second time (when find_package(dlib ...) is called).
Is there a reason why this flexibility is not implemented? (besides the comfort of not explicitely declaring the dependencies a second time)
The text was updated successfully, but these errors were encountered: