install( CODE/SCRIPT COMPONENT component "..."/file ) is ignored
CMakeLists.txt :
cmake_minimum_required(VERSION 3.16)
project(install_code C)
install( CODE "message (\"component unspecified\") " )
install( CODE COMPONENT comp "message (\"component comp\") " )
cmake_install.cmake :
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
message ("component unspecified")
endif()
if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "D:/dev/Bugs/cmake_code/build/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
dosn't contain "component comp" message.
$ mkdir build && cd build
$ cmake
....
$ cmake --install .
-- Install configuration: ""
component unspecified
$ cmake --install . --component comp
-- Install configuration: ""
Tested with cmake 3.16 to 3.20.2
Edited by مهدي شينون (Mehdi Chinoune)