I need to test for the presence of a directory called driver_root. I couldn't see a find_directory() command in the help so I am using the following lines in my CMakeLists.txt:<br><br> message("1 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")<br>
if (DEFINED ENV{DRV_ROOT})<br> find_file(DRV_ROOT_CHECK driver_root $ENV{DRV_ROOT}/..)<br> message("2 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")<br> endif()<br> <br> message("3 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")<br>
find_file(DRV_ROOT_CHECK driver_root <br> ../CVSFILES<br> ../..<br> ../../CVSFILES<br> ../../..<br> ../../../CVSFILES<br> ../../../..<br> )<br> message("4 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")<br>
<br> set(DRV_ROOT "${DRV_ROOT_CHECK}" CACHE PATH "Location of driver tree")<br> set(DRV_ROOT_CHECK "${DRV_ROOT_CHECK}" CACHE INTERNAL "Location of driver tree")<br>
<br> message("5 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}")<br> <br> if (DRV_ROOT_CHECK)<br> message(" DRV_ROOT: ${DRV_ROOT}")<br> else()<br> message(FATAL_ERROR "Unable to locate driver_root directory. Please set DRV_ROOT variable.")<br>
endif()<br><br>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:<br><br>1 DRV_ROOT_CHECK: <br>
3 DRV_ROOT_CHECK: <br>4 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root<br>5 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root<br> DRV_ROOT: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root<br>
<br>but on the build machine it produces this output:<br><br>1 DRV_ROOT_CHECK: <br>3 DRV_ROOT_CHECK: <br>4 DRV_ROOT_CHECK: C:/Windows/System32/driver_root<br>5 DRV_ROOT_CHECK: C:/Windows/System32/driver_root<br><br>There is no file or directory called driver_root in the windows/systsem32 folder. If I change the find_file() command to this:<br>
<br> find_file(DRV_ROOT_CHECK driver_root PATHS<br>
../CVSFILES<br>
../..<br>
../../CVSFILES<br>
../../..<br>
../../../CVSFILES<br>
../../../..<br> NO_DEFAULT_PATH<br>
)<br><br>then it works producing this output:<br><br>1 DRV_ROOT_CHECK: <br>3 DRV_ROOT_CHECK: <br>4 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root<br>5 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root<br><br>Is this a bug in cmake or can somebody explain how it found a non-existant file/folder in the windows/system32 folder ?<br>
<br>--<br>Glenn<br><br>