I’m learning the basics of CMake.
The task is to link external shared library and launch in debug/release mode.
I’m able to successfully link this library and build the project but I’m unable to launch the app because external library is shared and I need to setup the binary folder.
I know I can set this folder from IDE (I use Qt) but I’m looking for a CMake command to set up bin folder of shared linked library.
There is currently no sense of “runtime usage requirements” which would help with this, sorry. Windows does not support anything like rpaths to make it work either. You’ll just have to modify PATH to run the binary (or copy the DLL to be beside your library/executable).
Let’s suppose that my project builds one app and one shared lib (app depends on this lib) in the following folders:
C:\myApp\myApp\myApp.exe
C:\myApp\myLib\bin
C:\myApp\myLib\lib
C:\myApp\myLib\include
The point is that app and created lib are located in different folders. How would look like CMakeLists.txt of myApp? My gut tells me that best practice of CMake uses some CMake features to include the path to binary folder of shared myLib.
Windows has nothing like RPATH, so running from any directory either requires copying or setting PATH environment variable if the output path is not the same.