joycond icon indicating copy to clipboard operation
joycond copied to clipboard

CMake issues

Open v1993 opened this issue 5 years ago • 1 comments

I don't really have time to send PR myself right now, so I'll leave this as an issue:

  1. Is there really some reason to generate compile_commands.json on every build?
  2. Please use GNUInstallDirs instead of hardcoding paths where you install stuff. This allows end users to change destination prefix.
  3. Preppend what you're installing with either ${CMAKE_CURRENT_BINARY_DIR} or ${CMAKE_CURRENT_SOURCE_DIR}, as not doing this breaks not in-tree builds (mkdir build && cd build && sudo make install fails):
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/joycond" ...
)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/udev/89-joycond.rules" "${CMAKE_CURRENT_SOURCE_DIR}/udev/72-joycond.rules" ...
)

v1993 avatar Sep 24 '20 08:09 v1993

@v1993 I too encountered this issue.

I've opened #46 to address the problem when installing the joycond daemon from a separate build directory.

On the other hand, install(FILES ...) defaults to the current source directory, so, specifying ${CMAKE_CURRENT_SOURCE_DIR} for the other project files would be redundant.

https://cmake.org/cmake/help/latest/command/install.html#files

... File names given as relative paths are interpreted with respect to the current source directory. ...

cristian64 avatar Dec 27 '20 14:12 cristian64