On 06/02/2014 09:40 AM, Alessandro Di Federico wrote:
> I suggest to check version from `cp --version`

Okay.  I see the version output contains "GNU coreutils" too so that
can help verify that the version number is meaningful.

> I'm very new to CMake code base, what is the most appropriate location
> for a check like this?

Currently the file installation is in cmFileCopier::InstallFile here:

 
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmFileCommand.cxx;hb=v3.0.0-rc6#l1548

The call to cmSystemTools::CopyAFile should be refactored to invoke
"cp" or fall back to CopyAFile depending on the detection result.
We don't use threading so it should be safe to store the detection
result in a function-scoped static variable, e.g.

 static bool const useRefLink = cmFileCopier::DetectUseReflink();
 if(useRefLink)
   {
   // ... cp ...
   }
 else
   {
   // ... cmSystemTools::CopyAFile ...
   }

To run the child you can use cmSystemTools::RunSingleCommand:

 
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmSystemTools.h;hb=v3.0.0-rc6#l193

Use one of the overloads that takes a vector of arguments rather
than a command-line string.

Thanks,
-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to