From 186352e2955e47fe68cf44df685a1d7f08962bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 20 Nov 2018 18:58:36 +0100 Subject: [PATCH] conan: copy 3rd party dlls only if the conanDlls folder exists Note that this folder will only exists if at least one of the conan packages managed with the shared option = True. --- cmake/findDependencies.cmake | 6 ------ src/CMakeLists.txt | 10 ++++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 53201bc5..12d47525 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -54,9 +54,3 @@ if( BUILD_WITH_CCACHE ) endif() endif() -# On Windows we are interested in placing the DLLs together to the binaries in the install/bin -# folder, at the installation step. On other platforms we do not care about that, since the -# RPATHs will point the locations where the libraries where found. -if (USING_CONAN AND WIN32) - install(DIRECTORY ${PROJECT_BINARY_DIR}/conanDlls/ DESTINATION bin) -endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd1d2816..d1d5906d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -254,10 +254,16 @@ if(EXIV2_BUILD_EXIV2_COMMAND) target_include_directories(exiv2lib PRIVATE ${Intl_INCLUDE_DIRS}) endif() - # Copy DLLs from conan packages to the bin folder - if (USING_CONAN AND WIN32) + if (USING_CONAN AND WIN32 AND EXISTS ${PROJECT_BINARY_DIR}/conanDlls) + # In case of using conan recipes with their 'shared' option turned on, we will have dlls of + # the 3rd party dependencies in the conanDlls folder. + + # Copy 3rd party DLLs the bin folder. [build step] add_custom_command(TARGET exiv2 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/conanDlls ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + + # Copy 3rd party DLLs the bin folder. [install step] + install(DIRECTORY ${PROJECT_BINARY_DIR}/conanDlls/ DESTINATION bin) endif() install(TARGETS exiv2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})