norlab-ulaval / libpointmatcher

An Iterative Closest Point (ICP) library for 2D and 3D mapping in Robotics
BSD 3-Clause "New" or "Revised" License
1.61k stars 544 forks source link

Libnabo Cmake problem #442

Closed avgilias closed 3 years ago

avgilias commented 3 years ago

Hello, I am trying to generate libnabo, following step by step the tutorial and having the following probelm. Cmake Error : CMake Error at CMakeLists.txt:20 (message): Cannot grep version number: The system cannot find the file specified

I have already install grep (GnuWin32) on my system and add "C:\Program Files (x86)\GnuWin32\bin" on system variable path but it seems like CMake can't find it. Thank you very much for your time.

aguenette commented 3 years ago

Hi @avgilias!

Can you try replacing the following lines in the CMakeLists.txt

execute_process(
    COMMAND grep "NABO_VERSION " nabo/nabo.h
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    RESULT_VARIABLE GREP_VERSION_RESULT
    OUTPUT_VARIABLE PROJECT_VERSION
    OUTPUT_STRIP_TRAILING_WHITESPACE
)

if (NOT GREP_VERSION_RESULT EQUAL 0)
    message(SEND_ERROR "Cannot grep version number: ${GREP_VERSION_RESULT}")
endif ()

with these lines instead?

file(STRINGS "nabo/nabo.h" PROJECT_VERSION REGEX "#define NABO_VERSION ")

if (NOT PROJECT_VERSION)
    message(SEND_ERROR "Cannot grep version number: ${PROJECT_VERSION}")
endif ()

It's the same solution used for libpointmatcher to retrieve the version and I'm guessing that if it works for libpointmatcher for Windows users, this should also work for libnabo.

avgilias commented 3 years ago

@aguenette That worked perfectly. Thank you alot for your help and your time

aguenette commented 3 years ago

@avgilias you're welcome! 🙂