Copy DLL files to the binary directory on Mac and Linux.

According to the CMake documentation, we can use the following command to copy DLL files to the binary directory under the Windows operating system:

		COMMAND ${CMAKE_COMMAND} -E copy_if_different
		COMMENT "Copying DLLs to target directory")

However, for MacOS and Linux operating systems, the process isn’t as straightforward. I was wondering if there is something similar in nature for them as well?

MacOS and Linux have RPATH so you don’t need to copy SHARED libraries into the same directory as your executable. Windows lacks RPATH functionality.

1 Like

Great, so I don’t need to copy anything. But, do I need to include any special command to instruct the system to take advantage of RPATH or are they just self aware?

IIRC by default RPATH will be used in the build tree when it’s available.

1 Like