[CMake] find_library doesn't find .dll on windows
Juan E. Sanchez
juan.e.sanchez at gmail.com
Fri Jun 1 11:57:21 EDT 2018
My understanding is that you are supposed to link against the .lib file,
and the .dll is used at runtime.
From:
https://dev.mysql.com/doc/refman/5.7/en/c-api-building-clients.html
You link your code with either the dynamic or static C client library.
On Windows, the static library is named mysqlclient.lib and the dynamic
library is named libmysql.dll. In addition, the libmysql.lib static
import library is needed for using the dynamic library. If the static C
client library is used, the client application must be compiled with the
same version of Visual Studio used to compile the C client library
(which is Visual Studio 2013 for the static C client library built by
Oracle).
Regards,
Juan
On 6/1/18 9:53 AM, Romain LEGUAY wrote:
> Hi everyone,
>
> I try to find MYSQL dynamic library on windows.
> For this, I use the following command:
>
> set(_PF86 "ProgramFiles(x86)")
> find_library( MYSQL_LIBRARY
> NAME "libmysql.dll"
> PATHS "$ENV{PROGRAMFILES}/MySQL/*/lib"
> "$ENV{${_PF86}}/MySQL/*/lib"
> "$ENV{SYSTEMDRIVE}/MySQL/*/lib"
> NO_DEFAULT_PATH)
>
> This command doesn't work on my computer (Windows 10 Pro x64, CMake 3.11.3).
> If I remove the .dll extension, find_library find libmysql.lib which is
> in the same folder as libmysql.dll.
>
> How to say to CMake to use the name I chosen?
>
> Thank you!
> Romain
>
>
More information about the CMake
mailing list