[CMake] Add_Custom_Target to copy a directory not working with Ninja on Windows

Michael Jackson mike.jackson at bluequartz.net
Thu Oct 2 19:13:31 EDT 2014


I dug through the ninja build files and found the exact command into a
command prompt. The first time it worked. The second time it did not. Here
is the output:

C:\Users\admin>cmd.exe /C "cd /D
C:\Users\admin\Workspace\DREAM3D_Rewrite\ninja\
Applications\DREAM3D && C:\DREAM3D_SDK\cmake-3.0.2-win32-x86\bin\cmake.exe
-E copy_directory C:/DREAM3D_SDK/DREAM3D_Data/Data
C:/Users/admin/Workspace/DREAM3D_Rewrite/ninja/Bin/./Data/"
Error copying directory from "C:/DREAM3D_SDK/DREAM3D_Data/Data" to
"C:/Users/adm
in/Workspace/DREAM3D_Rewrite/ninja/Bin/./Data/".

So this is maybe a CMake error?

The failure seems to be intermittent. Hmm. And just to sanity check. there
is plenty of room on the hard drive.

Thoughts?
Mike Jackson


_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio

On Thu, Oct 2, 2014 at 6:39 PM, Michael Jackson <mike.jackson at bluequartz.net
> wrote:

> Tried a few different ideas:
>  First, I pulled the latest Ninja sources and built those. No luck, Still
> Failed.
> Next, I removed the manually added dependencies of the copy target on the
> application being built. Still Failed.
> Ran ninja with only a single thread (ninja -j1) AND IT WORKED!
>
> So I'll just assume that there is a threading issue between CMake and
> Ninja.
>
> I ran the same command from the command line and that worked just fine so
> it must be something in how ninja is trying to do the copy. Unfortunately
> there does not seem to be any failure log anywhere to get a better idea of
> _why_ it is failing.
>
>
> ---------- Forwarded message ----------
> From: Michael Jackson <mike.jackson at bluequartz.net>
> Date: Thu, Oct 2, 2014 at 5:57 PM
> Subject: Add_Custom_Target to copy a directory not working with Ninja on
> Windows
> To: "cmake at cmake.org" <cmake at cmake.org>
>
>
> Setup: Visual Studio 2013 Express, Ninja Version 1.5.1.git, Windows 7x64,
> CMake 3.0.1
>
> I am trying to build my project and when ninja gets to the point of
> copying a directory it fails most of the time. Sometimes (I think on a
> clean build) it works. Always fails when I am running the "ninja package'.
> Here is the cmake code that I use.
>
>
> #-------------------------------------------------------------------------------
> #- This copies all the Prebuilt Pipeline files into the Build directory so
> the help
> #- works from the Build Tree
> add_custom_target(PrebuiltPipelinesCopy ALL
>             COMMAND ${CMAKE_COMMAND} -E copy_directory
> ${DREAM3D_SUPPORT_DIR}/PrebuiltPipelines
>
> ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/PrebuiltPipelines/
>             COMMENT "Copying Prebuilt Pipelines into Binary Directory")
> set_target_properties(PrebuiltPipelinesCopy PROPERTIES FOLDER
> ZZ_COPY_FILES)
>
> # Make Sure this target as part of the DREAM3D Build
> add_dependencies(DREAM3D PrebuiltPipelinesCopy)
>
> #- This installs all the help files. Note that we assume a flat directory
> structure
> #- in the "Help" folder, ie, all html files, images, etc are all in the
> "Help"
> #- folder and NOT in any subfolders beyond that.
> install(DIRECTORY ${DREAM3D_SUPPORT_DIR}/PrebuiltPipelines
>         DESTINATION .
>         COMPONENT Applications )
>
> I can not figure out what is going wrong. Visual Studio will sometimes
> fail also. Has anyone encountered this before?
>
>
> Thanks
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141002/2465e4d3/attachment.html>


More information about the CMake mailing list