[CMake] Bug in find_file() command ?

Glenn Coombs glenn.coombs at gmail.com
Wed Oct 3 10:49:51 EDT 2012


I've just checked my C:/Windows/SysWOW64 directory and it does not contain
a driver_root directory.  It would have been a good catch if that was the
cause.

On 27 September 2012 19:20, Andreas Schenk
<andreas_schenk at hms.harvard.edu>wrote:

>  I had the same problem recently. Do you have a *driver_root* directory in* **C:/Windows/SysWOW64*?
> On 64-bit Windows systems the System32 directory contains the 64bit DLLs.
> For 32-bit executables (like cmake for example), the WOW64 subsystem automatically redirects
> System32 directory access to SysWOW64, where the 32-bit DLLs are stored.
> This has the side effect, that the path reported by find_file() doesn't correspond to
> the actual filesystem path for a file located in SysWOW64.
>
> Cheers,
> Andreas
>
>
> > Once the driver project has converted to using cmake that is what I plan to
> > do - use find_path() to look for driver_root/CMakeLists.txt.  But in the
> > meantime I'm stuck using find_file() instead which works but it looks like
> > a bug that I need to specify the NO_DEFAULT_PATH option to avoid getting an
> > incorrect match.
> >
> > --
> > Glenn
> >
> >
> >
> >On 3 September 2012 09:58, Adolfo Rodríguez Tsouroukdissian <>adolfo.rodriguez at pal-robotics.com <http://www.cmake.org/mailman/listinfo/cmake>> wrote:
> >
> >>**>>**>>* On Tue, Aug 28, 2012 at 6:59 PM, Glenn Coombs <glenn.coombs at gmail.com <http://www.cmake.org/mailman/listinfo/cmake>>wrote:*>>**>>>* I need to test for the presence of a directory called driver_root.  I*>>>* couldn't see a find_directory() command in the help*>>**>>**>>* I cannot comment about your issues concerning find_file, but if you know*>>* the name of a file contained in the directory you can use find_path:*>>**>*> http://cmake.org/cmake/help/v2.8.8/cmake.html#command:find_path*>>**>>* Cheers,*>>**>>* Adolfo.*>>**>>**>>>* so I am using the following lines in my CMakeLists.txt:*>>>**>>>*     message("1 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")*>>>*     if (DEFINED ENV{DRV_ROOT})*>>>*         find_file(DRV_ROOT_CHECK driver_root $ENV{DRV_ROOT}/..)*>>>*     message("2 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")*>>>*     endif()*>>>**>>>*     message("3 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")*>>>*     find_file(DRV_ROOT_CHECK driver_root*>>>*         ../CVSFILES*>>>*         ../..*>>>*         ../../CVSFILES*>>>*         ../../..*>>>*         ../../../CVSFILES*>>>*         ../../../..*>>>*     )*>>>*     message("4 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")*>>>**>>>*     set(DRV_ROOT       "${DRV_ROOT_CHECK}" CACHE PATH     "Location of*>>>* driver tree")*>>>*     set(DRV_ROOT_CHECK "${DRV_ROOT_CHECK}" CACHE INTERNAL "Location of*>>>* driver tree")*>>>**>>>*     message("5 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")*>>>**>>>*     if (DRV_ROOT_CHECK)*>>>*         message("   DRV_ROOT: ${DRV_ROOT}")*>>>*     else()*>>>*         message(FATAL_ERROR "Unable to locate driver_root directory.*>>>* Please set DRV_ROOT variable.")*>>>*     endif()*>>>**>>>* It works fine on my machine but fails on one of our build machines.  Both*>>>* machines are Windows 7 (64-bit) and are using CMake 2.8.9.  On my machine*>>>* it produces this output:*>>>**>>>* 1 DRV_ROOT_CHECK:*>>>* 3 DRV_ROOT_CHECK:*>>>* 4 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root*>>>* 5 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root*>>>*    DRV_ROOT: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root*>>>**>>>* but on the build machine it produces this output:*>>>**>>>* 1 DRV_ROOT_CHECK:*>>>* 3 DRV_ROOT_CHECK:*>>>* 4 DRV_ROOT_CHECK: C:/Windows/System32/driver_root*>>>* 5 DRV_ROOT_CHECK: C:/Windows/System32/driver_root*>>>**>>>* There is no file or directory called driver_root in the windows/systsem32*>>>* folder.  If I change the find_file() command to this:*>>>**>>>* find_file(DRV_ROOT_CHECK driver_root PATHS*>>>*         ../CVSFILES*>>>*         ../..*>>>*         ../../CVSFILES*>>>*         ../../..*>>>*         ../../../CVSFILES*>>>*         ../../../..*>>>*         NO_DEFAULT_PATH*>>>*     )*>>>**>>>* then it works producing this output:*>>>**>>>* 1 DRV_ROOT_CHECK:*>>>* 3 DRV_ROOT_CHECK:*>>>* 4 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root*>>>* 5 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root*>>>**>>>* Is this a bug in cmake or can somebody explain how it found a*>>>* non-existant file/folder in the windows/system32 folder ?*>>>**>>>* --*>>>* Glenn*>>>**>>>**>>>* --*>>>**>>>* 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*>>>**>>**>>**>>**>*> --*>*> Adolfo Rodríguez Tsouroukdissian*>*> Robotics engineer*>*> adolfo.rodriguez at pal-robotics.com <http://www.cmake.org/mailman/listinfo/cmake>*>*> http://www.pal-robotics.com*>>**>*> PAL ROBOTICS S.L*>*> c/ Pujades 77-79, 4º4ª*>*> 08005 Barcelona, Spain.*>*> Tel.  +34.93.414.53.47 *>*> Fax.+34.93.209.11.09*>>**>*> AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden*>*> contener información privilegiada y/o confidencial que está dirigida*>*> exclusivamente a su destinatario. Si usted recibe este mensaje y no es el*>*> destinatario indicado, o el empleado encargado de su entrega a dicha*>*> persona, por favor, notifíquelo inmediatamente y remita el mensaje original*>*> a la dirección de correo electrónico indicada. Cualquier copia, uso o*>*> distribución no autorizados de esta comunicación queda estrictamente*>*> prohibida.*>>**>*> CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may*>*> contain confidential information which is privileged and intended only for*>*> the individual or entity to whom they are addressed.  If you are not the*>*> intended recipient, you are hereby notified that any disclosure, copying,*>>* distribution or use of this e-mail and/or accompanying document(s) is*>>* strictly prohibited.  If you have received this e-mail in error, please*>>* immediately notify the sender at the above e-mail address.*
>
>
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121003/943f0e9b/attachment.htm>


More information about the CMake mailing list