<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<pre>I had the same problem recently. Do you have a <i>driver_root</i> directory in<i> </i><i>C:/Windows/SysWOW64</i>?
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 <
<a href="http://www.cmake.org/mailman/listinfo/cmake">>adolfo.rodriguez at pal-robotics.com</a>> wrote:
>
>><i>
</i>>><i>
</i>>><i> On Tue, Aug 28, 2012 at 6:59 PM, Glenn Coombs <<a href="http://www.cmake.org/mailman/listinfo/cmake">glenn.coombs at gmail.com</a>>wrote:
</i>>><i>
</i>>>><i> I need to test for the presence of a directory called driver_root. I
</i>>>><i> couldn't see a find_directory() command in the help
</i>>><i>
</i>>><i>
</i>>><i> I cannot comment about your issues concerning find_file, but if you know
</i>>><i> the name of a file contained in the directory you can use find_path:
</i>>><i>
</i>><i>> <a href="http://cmake.org/cmake/help/v2.8.8/cmake.html#command:find_path">http://cmake.org/cmake/help/v2.8.8/cmake.html#command:find_path</a>
</i>>><i>
</i>>><i> Cheers,
</i>>><i>
</i>>><i> Adolfo.
</i>>><i>
</i>>><i>
</i>>>><i> so I am using the following lines in my CMakeLists.txt:
</i>>>><i>
</i>>>><i> message("1 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")
</i>>>><i> if (DEFINED ENV{DRV_ROOT})
</i>>>><i> find_file(DRV_ROOT_CHECK driver_root $ENV{DRV_ROOT}/..)
</i>>>><i> message("2 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")
</i>>>><i> endif()
</i>>>><i>
</i>>>><i> message("3 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")
</i>>>><i> find_file(DRV_ROOT_CHECK driver_root
</i>>>><i> ../CVSFILES
</i>>>><i> ../..
</i>>>><i> ../../CVSFILES
</i>>>><i> ../../..
</i>>>><i> ../../../CVSFILES
</i>>>><i> ../../../..
</i>>>><i> )
</i>>>><i> message("4 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")
</i>>>><i>
</i>>>><i> set(DRV_ROOT "${DRV_ROOT_CHECK}" CACHE PATH "Location of
</i>>>><i> driver tree")
</i>>>><i> set(DRV_ROOT_CHECK "${DRV_ROOT_CHECK}" CACHE INTERNAL "Location of
</i>>>><i> driver tree")
</i>>>><i>
</i>>>><i> message("5 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")
</i>>>><i>
</i>>>><i> if (DRV_ROOT_CHECK)
</i>>>><i> message(" DRV_ROOT: ${DRV_ROOT}")
</i>>>><i> else()
</i>>>><i> message(FATAL_ERROR "Unable to locate driver_root directory.
</i>>>><i> Please set DRV_ROOT variable.")
</i>>>><i> endif()
</i>>>><i>
</i>>>><i> It works fine on my machine but fails on one of our build machines. Both
</i>>>><i> machines are Windows 7 (64-bit) and are using CMake 2.8.9. On my machine
</i>>>><i> it produces this output:
</i>>>><i>
</i>>>><i> 1 DRV_ROOT_CHECK:
</i>>>><i> 3 DRV_ROOT_CHECK:
</i>>>><i> 4 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root
</i>>>><i> 5 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root
</i>>>><i> DRV_ROOT: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root
</i>>>><i>
</i>>>><i> but on the build machine it produces this output:
</i>>>><i>
</i>>>><i> 1 DRV_ROOT_CHECK:
</i>>>><i> 3 DRV_ROOT_CHECK:
</i>>>><i> 4 DRV_ROOT_CHECK: C:/Windows/System32/driver_root
</i>>>><i> 5 DRV_ROOT_CHECK: C:/Windows/System32/driver_root
</i>>>><i>
</i>>>><i> There is no file or directory called driver_root in the windows/systsem32
</i>>>><i> folder. If I change the find_file() command to this:
</i>>>><i>
</i>>>><i> find_file(DRV_ROOT_CHECK driver_root PATHS
</i>>>><i> ../CVSFILES
</i>>>><i> ../..
</i>>>><i> ../../CVSFILES
</i>>>><i> ../../..
</i>>>><i> ../../../CVSFILES
</i>>>><i> ../../../..
</i>>>><i> NO_DEFAULT_PATH
</i>>>><i> )
</i>>>><i>
</i>>>><i> then it works producing this output:
</i>>>><i>
</i>>>><i> 1 DRV_ROOT_CHECK:
</i>>>><i> 3 DRV_ROOT_CHECK:
</i>>>><i> 4 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root
</i>>>><i> 5 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root
</i>>>><i>
</i>>>><i> Is this a bug in cmake or can somebody explain how it found a
</i>>>><i> non-existant file/folder in the windows/system32 folder ?
</i>>>><i>
</i>>>><i> --
</i>>>><i> Glenn
</i>>>><i>
</i>>>><i>
</i>>>><i> --
</i>>>><i>
</i>>>><i> Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
</i>>>><i>
</i>>>><i> Visit other Kitware open-source projects at
</i>>>><i> <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
</i>>>><i>
</i>>>><i> Please keep messages on-topic and check the CMake FAQ at:
</i>>>><i> <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
</i>>>><i>
</i>>>><i> Follow this link to subscribe/unsubscribe:
</i>>>><i> <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a>
</i>>>><i>
</i>>><i>
</i>>><i>
</i>>><i>
</i>><i>> --
</i>><i>> Adolfo Rodríguez Tsouroukdissian
</i>><i>> Robotics engineer
</i>><i>> <a href="http://www.cmake.org/mailman/listinfo/cmake">adolfo.rodriguez at pal-robotics.com</a>
</i>><i>> <a href="http://www.pal-robotics.com">http://www.pal-robotics.com</a>
</i>>><i>
</i>><i>> PAL ROBOTICS S.L
</i>><i>> c/ Pujades 77-79, 4º4ª
</i>><i>> 08005 Barcelona, Spain.
</i>><i>> Tel. <span skype_menu_props="{'numberToCall':'+34934145347' , 'isFreecall':false, 'isMobile':false, 'isRtl':false}" onmouseout="SkypeClick2Call.MenuInjectionHandler.hideMenu(event);" onmouseover="SkypeClick2Call.MenuInjectionHandler.showMenu(this, event);" tabindex="-1" dir="ltr" class="skype_pnh_container"> <span dir="ltr" class="skype_pnh_highlighting_inactive_common"><span class="skype_pnh_text_span">+34.93.414.53.47</span></span> </span>
</i>><i>> Fax.+34.93.209.11.09
</i>>><i>
</i>><i>> AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden
</i>><i>> contener información privilegiada y/o confidencial que está dirigida
</i>><i>> exclusivamente a su destinatario. Si usted recibe este mensaje y no es el
</i>><i>> destinatario indicado, o el empleado encargado de su entrega a dicha
</i>><i>> persona, por favor, notifíquelo inmediatamente y remita el mensaje original
</i>><i>> a la dirección de correo electrónico indicada. Cualquier copia, uso o
</i>><i>> distribución no autorizados de esta comunicación queda estrictamente
</i>><i>> prohibida.
</i>>><i>
</i>><i>> CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may
</i>><i>> contain confidential information which is privileged and intended only for
</i>><i>> the individual or entity to whom they are addressed. If you are not the
</i>><i>> intended recipient, you are hereby notified that any disclosure, copying,
</i>>><i> distribution or use of this e-mail and/or accompanying document(s) is
</i>>><i> strictly prohibited. If you have received this e-mail in error, please
</i>>><i> immediately notify the sender at the above e-mail address.</i></pre>
</body>
</html>