Copying created shared libraries

Yeah! i got it figured out.

To create the plugin based directory structure use the following

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

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

1 Like