[CMake] CMAKE_CFG_INTDIR expands to "$"(OutDir)

Bill Hoffman bill.hoffman at kitware.com
Mon Sep 17 20:47:20 EDT 2007


McKay Davis wrote:
> I'm experiencing trouble getting cmake to copy DLL files to my executable
> output path in visual studio after the target is built.  
>
> It seems that the CMAKE_CFG_INTDIR variable is being expanded to: "$"(OutDir)
>
> This causes the .dll files to be copied to the filename '$(OutDir)', not into
> the 'Debug' or 'Release' sub-directory as I would expect.
>
> Here is the relevant cmake code:
>
> IF(WIN32)
>   FILE(GLOB QT_DLLS "${QT_LIBRARY_DIR}/../bin/*.dll")
>
>   GET_FILENAME_COMPONENT(PTHREAD_LIBRARY_DIR "${PTHREAD_LIBRARY}" PATH)
>   FILE(GLOB PTHREAD_DLLS "${PTHREAD_LIBRARY_DIR}/*.dll")
>
>   SET(DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
>
>   FOREACH(DLL_FILENAME ${QT_DLLS} ${PTHREAD_DLLS})
>     ADD_CUSTOM_COMMAND(
>       TARGET ${PROJECT_NAME}
>       POST_BUILD
>       COMMAND ${CMAKE_COMMAND} -E copy
>       ${DLL_FILENAME} ${DESTINATION}
>       VERBATIM)
>       MESSAGE(COPY ${DLL_FILENAME} ${DESTINATION})
>   ENDFOREACH(DLL_FILENAME)
> ENDIF(WIN32)
>
>
> And here are a few lines from my VC++ buildlog.htm:
>
> "C:\Program Files (x86)\CMake 2.4\bin\cmake.exe" -E copy
> C:/Qt/4.3.1/lib/../bin/QtXml4.dll C:/bin/viewer/"$"(OutDir)
>
> "C:\Program Files (x86)\CMake 2.4\bin\cmake.exe" -E copy
> C:/Qt/4.3.1/lib/../bin/QtXmld4.dll C:/bin/viewer/"$"(OutDir)
>
>
> For some reason either cmake is quoting the $ in the expansion of the
> ${CMAKE_CFG_INTDIR} variable.  Does anyone know a fix for this?
>   
Did you try it without the VERBATIM specified?

-Bill



More information about the CMake mailing list