What is the best way to make tests that depend on a third-party DLL
(found through `find_package`) work when run from the RUN_TESTS target?

This scenario must be common so I surprised how hard it seems to be to
get it to work.

Let's say I have a library project that depends on OpenSSL (just an
example) and I'm building on Windows.  The project finds the OpenSSL
.lib file using `find_package`, and links against it.  The tests then
link against the project (let's assume statically).

That's fine for building, but to use the RUN_TESTS target, the tests
must be able to find the OpenSSL DLLs on the path.  And not just _any_
version of the DLLs, but the exact version whose .lib file the project
linked against.

Without any extra work, RUN_TESTS fails.  I've got it to work by using
ad-hoc knowledge of where the slproweb.com installer puts the DLLs on
windows, and passing that to a custom build step that invokes
`fixup_bundle` with that directory in the search path.  This is, of
course, brittle and specific to one library installer.  Also
`fixup_bundle` is slow and crazy overkill, when all I want is to tell
the tests where the DLL is.  Surely there must be a better, more general
solution?

All advice appreciated.

Alex

--
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

-- 

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:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to