Hello Hauke, thanks for the answer! I already got some workaround which is very similar to your suggestion: as I have this problem only in windows/msvc mode I use a batch-script now which takes the $<CONFIGURATION> variable as an argument. Within the bat-script I check the content of %<CONFIGURATION>, i.e. "Release","Debug" etc. and set some batch-variables appropriately. I don't like it very much but it works.
-----Ursprüngliche Nachricht----- Von: Hauke Heibel [mailto:[email protected]] Gesendet: Montag, 9. Januar 2012 15:45 An: Michael Stürmer Cc: [email protected] Betreff: Re: [CMake] Copying of 3rd party DLLs in a POST-BUILD step Hi Michael, What I do is running a custom command which itself executes a CMake script. Usually similar to add_custom_command(TARGET CopyDlls COMMAND ${CMAKE_COMMAND} -DMSVC_BUILD_CONFIG_DIR=${CMAKE_CFG_INTDIR} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -P "<pathto>/yourCopyDlls.cmake" VERBATIM ) In the "yourCopyDlls.cmake", you can GLOB your DLLs with or without the "d" postfix depending on MSVC_BUILD_CONFIG_DIR. You can now even copy additional files such as e.g. PDB files. HTH, Hauke 2012/1/9 Michael Stürmer <[email protected]>: > I have found some topics related to my issue on the web, but none so far > helped me to fix it: > > > > I use Visual Studio 2010 on Windows 7 64Bit. > > > > During my build, all binaries are collected in one folder, which makes it > easier for me to debug the project. But to be able to run the program > actually, I have to copy several dlls (like Qt, openCV etc.) into the folder > for the program to find them. Putting the libraries in the system path is > not an option for me, as I switch between 32- and 64-bit on the same system. > > > > I managed to locate the folder where the dlls are (using some > CMake-Variables) and using a custom command like > > > > ADD_CUSTOM_COMMAND( TARGET CopyDlls POST_BUILD > > COMMAND copy "${DLL_3RD}/*.dll" > "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIGURATION>" > > COMMENT "copying dlls ." > > ) > > > > This copies ALL dlls from the ${DLL_3RD} folder to the binary folder, for Qt > that would be the relase as well as the debug libraries. > > > > Now my question: > > > > I would like to only copy those dlls I need, i.e. I have to determine > somehow if I'm in debug or release mode and select the appropriate libraries > by adding "d" for debug versions. For openCV I need "opencv_core231.dll" in > release and "opencv_core231d.dll" in debug mode. Does anyone have a > solution/workaround/idea for this problem? > > > > Best regards, > > Michael > > > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
