[Windows][DLL] avoid copy of dll
We maybe could investigate the possibility to create link (aka shortcut or symlink) to the dll instead of copying them in each project folder.
We have several "level" of links on windows:
- The first level that works is to simply create a shortcut to the dll. In command line:
mklink "(...)\mbsysc\ExampleProjects\TutorialProjects\1_Bodies_and_Joints\workR\build\Release\libopenblas.dll" "(...)\mbsysc\MBsysC\win64_include_lib\dll\libopenblas.dll". However if the original file is deleted or moved, the link is broken.
- The second level that works is to use an "hard link". This is achieved in command line with
mklink /H "(...)\mbsysc\ExampleProjects\TutorialProjects\1_Bodies_and_Joints\workR\build\Release\libopenblas.dll" "(...)\mbsysc\MBsysC\win64_include_lib\dll\libopenblas.dll". In this case if the original file is deleted, the link will stay functional.
However implementing this solution in CMakeLists with the
execute_process(COMMAND cmd /c mklink \"(...)/ExampleProjects/TutorialProjects/1_Bodies_and_Joints/workR/build/Release/libopenblas.dll\" \"(...)/MBsysC/win64_include_lib/dll/libopenblas.dll\") command does not work because it required the ADMIN right on windows...
There are two type of symbolic links: Hard and soft. Soft symbolic links work similarly to a standard shortcut. When you open a soft link to a folder, you will be redirected to the folder where the files are stored. However, a hard link makes it appear as though the file or folder actually exists at the location of the symbolic link, and your applications won’t know any better. That makes hard symbolic links more useful in most situations.