norlab-ulaval / libnabo

A fast K Nearest Neighbor library for low-dimensional spaces
http://norlab-ulaval.github.io/libnabo/
BSD 3-Clause "New" or "Revised" License
431 stars 142 forks source link

CMake fail to build MSVC (2019) project if grep.exe is not found in PATH. Fixed by modifying CMakeList.txt #115

Closed GordonEldest closed 2 years ago

GordonEldest commented 2 years ago

grep is needed by the "libnabo-master\CMakeLists.txt" file to find revision But not every Windows machine have a "grep.exe" in the Windows Path. However It is available in VS typically in a set of Unix command supplied by Microsoft in "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\usr\bin\"

I did NOT want to add this to my PATH variable (may interfere with mingw), then I fix that by an ugly patch of the "libnabo-master\CMakeLists.txt" replacing line 13

COMMAND "grep "NABO_VERSION " nabo/nabo.h

by

COMMAND "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\Git\\usr\\bin\\grep.exe" "NABO_VERSION " nabo/nabo.h

And it worked fine.

Could be good to modify "libnabo-master\CMakeLists.txt" to search for grep and use the rather generic one supplied by MS VS as alternate if none found. (BTW most of the Path is already found during the Compiler analysis phase of "Config" of CMAKE)