From eee5d083e32a518ce98ffc28cfdf79a781d9c3f0 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 13 Apr 2015 16:55:26 +0200 Subject: [PATCH] copying mhd dlls --- cmake/EthDependencies.cmake | 1 + cmake/EthExecutableHelper.cmake | 7 +++++++ cmake/FindMHD.cmake | 14 +++++++------- eth/CMakeLists.txt | 4 +++- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 61c87efd2..9c38b6919 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -59,6 +59,7 @@ if (JSONRPC) find_package(MHD) message(" - microhttpd header: ${MHD_INCLUDE_DIRS}") message(" - microhttpd lib : ${MHD_LIBRARIES}") + message(" - microhttpd dll : ${MHD_DLLS}") endif() #JSONRPC diff --git a/cmake/EthExecutableHelper.cmake b/cmake/EthExecutableHelper.cmake index 0c529881f..8d7bb6770 100644 --- a/cmake/EthExecutableHelper.cmake +++ b/cmake/EthExecutableHelper.cmake @@ -43,6 +43,13 @@ macro(eth_add_executable EXECUTABLE) endmacro() +macro(eth_copy_dlls EXECUTABLE DLLS) + add_custom_command(TARGET ${EXECUTABLE} POST_BUILD COMMNAND ${CMAKE_COMMAND} + -DLIBS="${DLLS}" + -DCONFIGURATION="$" + -DDESTINATION="${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" +endmacro() + # # this function requires the following variables to be specified: # ETH_DEPENDENCY_INSTALL_DIR diff --git a/cmake/FindMHD.cmake b/cmake/FindMHD.cmake index b3f4dc546..1915b2f19 100644 --- a/cmake/FindMHD.cmake +++ b/cmake/FindMHD.cmake @@ -37,10 +37,6 @@ set(MHD_LIBRARIES ${MHD_LIBRARY}) # official MHD project actually uses _d suffix if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - #TODO: place dlls into CMAKE_CFG_INTDIR subfolders - #string(REPLACE ".lib" ".dll" MHD_DLL_RELEASE ${MHD_LIBRARY}) - #string(REPLACE "/lib/" "/bin/" MHD_DLL_RELEASE ${MHD_DLL_RELEASE}) - if (CMAKE_CL_64) set(MHD_NAMES_DEBUG microhttpd_d_x64 microhttpd-10_d_x64 libmicrohttpd_d_x64 libmicrohttpd-dll_d_x64) else () @@ -53,11 +49,15 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") DOC "mhd debug library" ) - # not sure why this was commented - # always use release for now, need to ask Arkadiy - #string(REPLACE ".lib" ".dll" MHD_DLL_DEBUG ${MHD_LIBRARY_DEBUG}) set(MHD_LIBRARIES optimized ${MHD_LIBRARIES} debug ${MHD_LIBRARY_DEBUG}) + # prepare dlls + string(REPLACE ".lib" ".dll" MHD_DLL ${MHD_LIBRARY}) + string(REPLACE "/lib/" "/bin/" MHD_DLL ${MHD_DLL}) + string(REPLACE ".lib" ".dll" MHD_DLL_DEBUG ${MHD_LIBRARY_DEBUG}) + string(REPLACE "/lib/" "/bin/" MHD_DLL_DEBUG ${MHD_DLL_DEBUG}) + set(MHD_DLLS optimized ${MHD_DLL} debug ${MHD_DLL_DEBUG}) + endif() include(FindPackageHandleStandardArgs) diff --git a/eth/CMakeLists.txt b/eth/CMakeLists.txt index fbc6a8b24..047f81c49 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -29,7 +29,9 @@ target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} ethash) if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW) - add_custom_command(TARGET ${EXECUTABLE} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${MHD_DLL_RELEASE} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + eth_copy_dlls(${EXECUTABLE} ${MHD_DLLS}) + #add_custom_command(TARGET ${EXECUTABLE} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${MHD_DLL_RELEASE} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + endif() install( TARGETS ${EXECUTABLE} DESTINATION bin )