Conan: Question: Building unit test with DLL dependencies

Created on 7 Nov 2017  路  2Comments  路  Source: conan-io/conan

Hi there,

I'm wondering if there's an easy/efficient way to build a project's unit test on Windows.
I have one project that depends on Boost, and the unit tests fail because I didn't copy the DLL files.

Note that this is done during the build method, with the CMake helper.

I'm wondering if the imports method could be used here, I've never used it outside of test_package though.

If you have an idea I'd be glad to hear it!

question

Most helpful comment

It works perfectly \o/

Thanks a lot!

All 2 comments

Yes, the imports() method also works fine for build(). Indeed the behavior of building is:

  • Copy the sources to the build folder
  • Call the imports() method in the build folder. Binaries of dependencies will be copied there
  • Call the build() method. It can use the dependencies imported files, like DLLs
  • After build() those copied files will be automatically removed, so they are not re-packaged (they are already packaged in the dependency, and when installed the dependency package will also be retrieved)

Please try it and tell me how it goes.

It works perfectly \o/

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings