DanielOgorchock / joycond

userspace daemon to combine joy-cons from the hid-nintendo kernel driver
GNU General Public License v3.0
340 stars 68 forks source link

Installing CMake targets as opposed to installing targets' files. #46

Closed cristian64 closed 3 years ago

cristian64 commented 3 years ago

It was not possible to run the CMake configuration step in a different directory other than the root directory of the project, as CMake would then not be capable of locating the joycond executable file at installation time.

As an example, when running

cd /tmp
git clone https://github.com/DanielOgorchock/joycond.git
mkdir joycond-build-release
cd joycond-build-release
cmake ../joycond -DCMAKE_BUILD_TYPE=Release
cmake --build . --parallel
sudo cmake --build . --target install

, the following error was produced:

[100%] Built target joycond
Install the project...
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:54 (file):
  file INSTALL cannot find "/tmp/joycond/joycond": No such
  file or directory.

Makefile:126: recipe for target 'install' failed
make: *** [install] Error 1

The fix consists of installing the joycond CMake target (via install(TARGETS ...)), instead of merely installing the joycond file.

cristian64 commented 3 years ago

Should solve #31.

DanielOgorchock commented 3 years ago

Thanks!