Re: [CMake] find_library doesn't find .dll on windows

2018-06-12 Thread Bo Zhou
Hi,

This is a feature/problem on Windows, the library used for dynamic linking
is not the runtime module as Linux or OSX but the .lib, a collection of
symbols.

I suggest you could still use find_library() to locate the .lib file for
linking, then use find_file() to collect the runtime file then install it
to the distribution.

Thanks.

On Fri, Jun 1, 2018 at 11:53 PM 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
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] find_library doesn't find .dll on windows

2018-06-11 Thread Cyril Boucher
Hi Romain,

Just to give you more insight on this and add details on top of Juan's
answer, CMake will only able to find libraries with the .lib extension
because it is what you are supposed to link against. And CMake explicitly
defines that in the following file:

https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/Platform/Windows.cmake

As you can see at line 23, the CMAKE_FIND_LIBRARY_SUFFIXES is set to .lib
only, no .dll here.

I guess you could always change that variable to meet your needs but it is
not recommended!

Hope that helps!
Cyril

2018-06-05 17:21 GMT+02:00 Bill Hoffman :

> On 6/1/2018 6:30 PM, Romain LEGUAY wrote:
>
>> Thank you for your answer.
>>
>> I just want to find the file libmysql.dll because it's needed to be used
>> with Qt (unless I did not understand how to use Qt's MySQL driver).
>> For now, I just do a simple copy of this file in my build folder, but
>> it's not a good method.
>>
>
> So, for Windows runtime you have to have the dll in the same directory as
> the exe or in the PATH.  There is no concept of rpath built into an exe.
>
> -Bill
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensou
> rce/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] find_library doesn't find .dll on windows

2018-06-05 Thread Bill Hoffman

On 6/1/2018 6:30 PM, Romain LEGUAY wrote:

Thank you for your answer.

I just want to find the file libmysql.dll because it's needed to be 
used with Qt (unless I did not understand how to use Qt's MySQL driver).
For now, I just do a simple copy of this file in my build folder, but 
it's not a good method.


So, for Windows runtime you have to have the dll in the same directory 
as the exe or in the PATH.  There is no concept of rpath built into an exe.


-Bill


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] find_library doesn't find .dll on windows

2018-06-01 Thread Romain LEGUAY
Thank you for your answer.

I just want to find the file libmysql.dll because it's needed to be used
with Qt (unless I did not understand how to use Qt's MySQL driver).
For now, I just do a simple copy of this file in my build folder, but it's
not a good method.

Romain


Le ven. 1 juin 2018 à 17:58, Juan E. Sanchez  a
écrit :

> 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
> >
> >
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] find_library doesn't find .dll on windows

2018-06-01 Thread Juan E. Sanchez
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




--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] find_library doesn't find .dll on windows

2018-06-01 Thread Romain LEGUAY
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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake