Installation (“Deployment”)¶
“Prefix”: Where Everything Comes Together¶
Multiple projects usually are installed at one prefix ⟶
/usr
Subdirectories
bin/
: executableslib/
(orlib64
): librariesinclude/
: header files (usually comes with-dev
or-devel
distro packages, as do static libraries)share/
: data files(more)
Build parameter:
CMAKE_INSTALL_PREFIX
(default:/usr/local
)
$ cmake -DCMAKE_INSTALL_PREFIX=/tmp/install /home/jfasch/work/jfasch-home/trainings/material/soup/cmake/07-install-basic
Installing Targets¶
INSTALL(TARGETS hello DESTINATION lib) # <--- lands in <prefix>/lib/
INSTALL(TARGETS hello-first DESTINATION bin) # <--- lands in <prefix>/bin/
INSTALL(TARGETS hello-second DESTINATION bin) # <--- lands in <prefix>/bin/
Doing The Installation (make install
)¶
$ cmake -DCMAKE_INSTALL_PREFIX=/tmp/install /home/jfasch/work/jfasch-home/trainings/material/soup/cmake/07-install-basic
$ make
$ make install
...
Install the project...
-- Install configuration: ""
-- Installing: /tmp/install/lib/libhello.a
-- Installing: /tmp/install/bin/hello-first
-- Installing: /tmp/install/bin/hello-second
$ tree /tmp/install/
/tmp/install/
├── bin
│ ├── hello-first
│ └── hello-second
└── lib
└── libhello.a