On Thu, Dec 23, 2010 at 11:18 AM, Stormwind Dev <[email protected]> wrote: > Dear List, > > I've got a question on copying some files from one directory to another > using CMake. > > Let's say, I got some libraries collected in a special directory. I want > CMake to copy these libs to the distribution directory of my project. Using > add_custom_command, I managed to have CMake copy my .exe to the distribution > directory, but when I try to do this for my libraries something goes > terribly wrong. > > add_custom_command( TARGET MagicRPG POST_BUILD > COMMAND copy \"$(TargetPath)\" .\\dist\\bin ) > > is what I did to copy my exe. When I use this > > add_custom_command( TARGET MagicRPG POST_BUILD > COMMAND copy \"$(TargetPath)\" \"${SDKS_BASE_DIR}/SDL/lib/SDL.dll\" > .\\dist\\bin) > > to get SDL.dll copied to dist/bin Visual Studio fails with message > > Fehler 1 error MSB3073: Der Befehl "copy > "D:\Projekte\cpp\games\Magic\bin\Debug\MagicRPG.exe" > "D:/SDKs/SDL/lib/SDL.dll" .\dist\bin > if errorlevel 1 goto VCReportError > :VCEnd" wurde mit dem Code 1 beendet. C:\Program Files > (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113 6 > MagicRPG > > Can anybody please help me with the right syntax for copying multiple files > at POST_BUILD? >
Attached are 3 CMake modules I use for this. One is a macro that
builds a batch file that ends up being a target in visual studio.
I put them in a CMake folder inside my root source folder and have the
following line in my main CMakeLists.txt
include(${PROJECT_SOURCE_DIR}/CMake/GetRuntime.cmake)
this brings in the macro with support for generating the batch file
and GetRuntime target.
Then later in the main CMakeLists.txt file I use the other two modules.
FIND_PACKAGE( Qt4 REQUIRED )
set(QT_USE_QTNETWORK true)
set(QT_USE_QTSQL true)
set(QT_USE_QTXML true)
INCLUDE( ${QT_USE_FILE} )
include(${PROJECT_SOURCE_DIR}/CMake/GetQtRuntime.cmake)
IF(USE_QWT)
FIND_PACKAGE(Qwt REQUIRED)
INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIR})
include(${PROJECT_SOURCE_DIR}/CMake/GetQwtRuntime.cmake)
set (UPMC_EXTERNAL_LIBS ${UPMC_EXTERNAL_LIBS} ${QWT_LIBRARIES})
ENDIF(USE_QWT)
John
GetRuntime.cmake
Description: Binary data
GetQtRuntime.cmake
Description: Binary data
GetQwtRuntime.cmake
Description: Binary data
_______________________________________________ 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
