For CMake’s “install” command, what can the COMPONENT argument do?

You can group installation targets into components, for example, “docs”, “libs”, “runtime”, etc.

add_library(libone libone.c)
add_executable(one main1.c)
install(TARGETS libone one DESTINATION /somedir COMPONENT comp_one)

add_library(libtwo libtwo.c)
add_executable(two main2.c)
install(TARGETS libtwo two DESTINATION /somedir COMPONENT comp_two)

This makes it possible to run cmake -DCOMPONENT=comp_one -P {your_build_dir}/cmake_install.cmake to install only the libone library and the one executable. When you issue make install all components are installed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)