norlab-ulaval / libpointmatcher

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

CMake config files are installed incorrectly #29

Closed hrabalik closed 10 years ago

hrabalik commented 10 years ago

CMake config files are now valid (ad #27), but they need to be installed into the cmake (lowercase) directory instead of CMake, i. e.

/usr/local/lib/cmake/pointmatcher

in order to be recognized by CMake.

hrabalik commented 10 years ago

In a related issue, in the generated pointmatcherConfig.cmake, there is a space after a semicolon in the library list:

set(POINTMATCHER_LIBRARIES "/usr/local/lib/libpointmatcher.a; /usr/local/lib/libnabo.a;...
                                                             ^

This produces a CMake error when linking to the libraries:

Target links to item " /usr/local/lib/libnabo.a" which has leading or trailing whitespace. This is now an error according to policy CMP0004.

pomerlef commented 10 years ago

That is getting interesting. I based the installation on the following: http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file

Which use capital letters for the CMake repository:

if(WIN32 AND NOT CYGWIN)
  set(DEF_INSTALL_CMAKE_DIR CMake)
else()
  set(DEF_INSTALL_CMAKE_DIR lib/CMake/FooBar)
endif()

Nevertheless, I changed it for the lower case version and removed the whitespace in the commit 0000687d511627848f7dde6a45a8d9729c2f1273.

I'll let you test and close the issue. Don't forget to remove your CMakeCache.txt file before testing.

Thanks!

hrabalik commented 10 years ago

According to CMake 2.6 docs, CMake searches the following directories for config files on Unix-like systems:

<prefix>/(share|lib)/cmake/<name>*/
<prefix>/(share|lib)/<name>*/
<prefix>/(share|lib)/<name>*/(cmake|CMake)/

We are using the first rule, which explains the behaviour. The CMake tutorial was seemingly not tested.


Unfortunately, I encountered another (hopefully the last) issue. In POINTMATCHER_INCLUDE_DIRS, there is my source dir, for example

/home/tufak/Libraries/libpointmatcher

which is not a problem, unless the directory is deleted after install. This is the minimal (though not very pretty) hack of the main CMakeLists.txt file that fixed the issue for me:

$ diff CMakeLists.txt-backup CMakeLists.txt
203a204
> list(REMOVE_ITEM CONF_INCLUDE_DIRS ${CMAKE_SOURCE_DIR})
pomerlef commented 10 years ago

Thanks for the suggestion. It was added to the commit fbce870af87ad55e8236c597d1ae8a9fdb86f9d1

Hopefully, we are ready for an easy CMake linking for users.

hrabalik commented 10 years ago

Works great for me, thank you for your time.