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.
This commit is contained in:
Luis Díaz Más 2018-11-20 18:58:36 +01:00
parent 89375979d8
commit 186352e295
2 changed files with 8 additions and 8 deletions

View File

@ -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()

View File

@ -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})