Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake projects on Windows do not copy DLLs to output folder. #16557

Closed
fishnet37222 opened this issue Mar 5, 2021 · 9 comments
Closed

CMake projects on Windows do not copy DLLs to output folder. #16557

fishnet37222 opened this issue Mar 5, 2021 · 9 comments
Assignees
Labels
category:documentation To resolve the issue, documentation will need to be updated category:question This issue is a question

Comments

@fishnet37222
Copy link

Describe the bug
When using vcpkg to pull in dependencies as DLLs, the resulting DLLs are not copied into the output folder.

Environment

  • OS: [Windows]
  • Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29910 for x64

To Reproduce
Steps to reproduce the behavior:

  1. Open the repository at https://github.com/fishnet37222/HelloWorld.git in either Visual Studio or Visual Studio Code
  2. Build the project.
  3. Inspect the contents of the output folder.

Expected behavior
The DLLs generated by the libraries pulled in by vcpkg should be copied to the output folder.

Failure logs
No failure logs generated.

Additional context
The sample project I created references both wxWidgets and Boost-filesystem.
See https://github.com/fishnet37222/vcpkg-test.git for a regular Visual Studio C++ project using vcpkg in which the issue does not occur.

@NancyLi1013 NancyLi1013 added the category:question This issue is a question label Mar 8, 2021
@NancyLi1013
Copy link
Contributor

Hi @fishnet37222

Thanks for posting this issue.

It seems that the link you provided above are wrong. Since I clicked them and both of them are directed to https://github.com/microsoft/vcpkg/issues/url.

Could you please help provide your project sample and attach your result here?

@JackBoosY
Copy link
Contributor

Please see feature X_VCPKG_APPINSTALL_DEPS_INSTALL .
Related: #14243

@fishnet37222
Copy link
Author

I've attached the two projects as requested.

HelloWorld.zip
vcpkg-test.zip

@NancyLi1013
Copy link
Contributor

@fishnet37222

Have you tried the above suggestions from @JackBoosY ?

@fishnet37222
Copy link
Author

Is there any documentation on how to use what @JackBoosY was referring to?

@NancyLi1013
Copy link
Contributor

Currently there is no any documentation about this feature. Since it is experimental.

I think you may set X_VCPKG_APPLOCAL_DEPS_INSTALL as ON to rebuild vcpkg and verify if this can work.

option(X_VCPKG_APPLOCAL_DEPS_INSTALL "(experimental) Automatically copy dependencies into the install target directory for executables." OFF)
https://github.com/microsoft/vcpkg/blob/master/scripts/buildsystems/vcpkg.cmake#L49

@fishnet37222
Copy link
Author

I tried setting that property to ON in my CMakeLists.txt file, but the DLLs were still not copied to the output folder. I also noticed that when I create a console application (the add_executable command does not include WIN32), the DLLs do get copied to the output folder.

@pratikpc
Copy link
Contributor

pratikpc commented May 3, 2021

@NancyLi1013 do you know if X_VCPKG_APPINSTALL_DEPS_INSTALL copies only VCPKG dependencies or if it will also copy my shared library's DLLs?

Say if I have a Windows project with

  1. Boost Asio
  2. My Shared Library which generates a DLL

Would X_VCPKG_APPINSTALL_DEPS_INSTALL only copy Boost Asio or would it also copy My Shared Library's DLLs?

@JackBoosY
Copy link
Contributor

@pratikpc Yes, it should do that.

@JackBoosY JackBoosY added the category:documentation To resolve the issue, documentation will need to be updated label Jun 10, 2021
@microsoft microsoft locked and limited conversation to collaborators Aug 6, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
category:documentation To resolve the issue, documentation will need to be updated category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

5 participants