Issue
If I have a line install( TARGETS prog DESTINATION foo )
in my CMakeLists.txt, the target gets installed in CMAKE_INSTALL_PREFIX/foo/prog
, so I figured having
install( TARGETS prog )
would put it in CMAKE_INSTALL_PREFIX/prog
. But no, it goes in CMAKE_INSTALL_PREFIX/bin/prog
.
How can I install a target directly in the prefix location?
Solution
You can use .
as the destination:
install(TARGETS prog DESTINATION .)
If you don't specify the destination, the default path for executables is used, which is bin
.
Answered By - fabian Answer Checked By - Clifford M. (WPSolving Volunteer)