# Copying created shared libraries

**URL:** https://discourse.cmake.org/t/copying-created-shared-libraries/4936
**Category:** Code
**Created:** [January 31, 2022, 10:13pm UTC](https://discourse.cmake.org/t/copying-created-shared-libraries/4936 "2022-01-31T22:13:09Z")
**Posts on this page:** 1
**Showing post:** 18

<div class="post-metadata">

### Author: ![scottaronbloom](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@scottaronbloom](https://discourse.cmake.org/u/scottaronbloom)
#### Post date: [February 3, 2022, 7:46pm UTC](https://discourse.cmake.org/t/copying-created-shared-libraries/4936/18 "2022-02-03T19:46:58Z")

</div>

Yeah! i got it figured out.

To create the plugin based directory structure use the following

```auto
set_target_properties( imagelib PROPERTIES 
                                RUNTIME_OUTPUT_DIRECTORY "$<CONFIG>/imageformats"
                                ARCHIVE_OUTPUT_DIRECTORY "$<CONFIG>/imageformats"
                                LIBRARY_OUTPUT_DIRECTORY "$<CONFIG>/imageformats"
)

```

Then for the executable, you set the following

```auto
set_target_properties( exec 
                                    VS_DEBUGGER_WORKING_DIRECTORY "$<TARGET_FILE_DIR:exec>" 
                                    VS_DEBUGGER_COMMAND "$<TARGET_FILE:exec>" 
                                    VS_DEBUGGER_ENVIRONMENT "PATH=PATH=%PATH%;$<TARGET_FILE_DIR:sharedlib1>;$<TARGET_FILE_DIR:sharedlib2>\nQT_PLUGIN_PATH="$<TARGET_FILE_DIR:plugin1>/..;$<TARGET_FILE_DIR:plugin2>/.."
                     )

```

Note 1, in the VS\_DEBUGGER\_ENVIRONMENT you must separate the variables by an explicit **\n** for Visual Studio to recognize multiple variables being set.

Note 2, in the QT\_PLUGIN\_PATH you are setting it to $\<TARGET\_FILE\_DIR:plugin1\>/… **Note the /…** , since the target file dir includes imageformats

I have not tested this on other IDE systems, so YMMV on xcode etc

Thanks for tall the help

---

_[View the full topic](https://discourse.cmake.org/t/copying-created-shared-libraries/4936)._
