[CMake] How to find the DLL's a a required package searched with FIND_PACKAGE()?

Ryan Pavlik rpavlik at iastate.edu
Wed Feb 10 20:53:45 EST 2010


You can use configure_file to create the .vcproj.user files that contain the
debug-time environment variables (including path) - but that doesn't solve
the build-time issue. You might copy the dll to the build directory in a
PRE_BUILD custom command.

Ryan

On Wed, Feb 10, 2010 at 6:20 PM, David Cole <david.cole at kitware.com> wrote:

> On Wed, Feb 10, 2010 at 7:16 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca>wrote:
>
>> On 2010-02-10 23:41+0100 Gabriel Petrovay wrote:
>>
>>  Hi,
>>>
>>> We are using CMake 2.6. For Windows we need the DLL's of the required
>>> libraries for two reasons given below.
>>>
>>> Take for example LibXml.dll which is required by our project in order to
>>> run
>>> on Windows. One can build and link our project successfully because the
>>> FindLibXml2.cmake provides:
>>> #  LIBXML2_INCLUDE_DIR - The LibXml2 include directory
>>> #  LIBXML2_LIBRARIES - The libraries needed to use LibXml2
>>>
>>> But we also need a reference to the LibXml2.dll file for the following 2
>>> reasons.
>>>
>>> 1. When you "make" the "install" target (e.g. "nmake install"), the dll
>>> of
>>> the required library has to go into the "bin" directory, as well where
>>> our
>>> executable.
>>> 2. We also need to set the PATH environment variable in order to execute
>>> our
>>> own executable (during the build, a bootstrap executable). So we need it
>>> in
>>> a scenario like:
>>> SET(ENV{PATH} ${LIBXML2_DLL})
>>>
>>
>> Would setting that environment variable from cmake affect subsequent
>> Windows
>> builds?  I don't have any Windows development experience, but this
>> question
>> just came up on the PLplot list. There, we all speculated from our various
>> Linux and Windows platform perspectives that SET(ENV{PATH} ...) just sets
>> the PATH when you are running cmake and would have no effect on the
>> environment for the subsequent build.  Thus, we thought you would have to
>> externally set the PATH before running the build.  But we all could be
>> wrong
>> which is why I have asked this question.  :-)
>>
>>
> Alan,
>
> You are correct. Doing this...
>
> SET(ENV{xxx} "value")
>
> ...in a CMakeLists.txt file only sets an environment variable for the
> duration of the cmake run. It has no influence on downstream build steps.
>
> HTH,
> David
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100210/1df1bec8/attachment.htm>


More information about the CMake mailing list