[CMake] cpack component

Lars Lars laasunde at hotmail.com
Mon Sep 2 06:35:55 EDT 2013


Hello,
We are using CPack (WIX generator) to create an installer. This works fine but with one slight problem that the installer contains a component that I did not expect.
The main CMakeList.txt file includes;
SET(CPACK_COMPONENTS_ALL RUNTIME)
In a sub CMakeList.txt file I have the following line:
INSTALL(
  DIRECTORY ${DOC_PATH}
  DESTINATION ${INSTALL_DOC_DIR}
  COMPONENT DOC)
The current installer should not include this component but another installer will include this component.
In the cmake_install.cmake that correspond to the sub CMakeList.txt I find the code below. 

# Set the component getting installed.
IF(NOT CMAKE_INSTALL_COMPONENT) # true
  IF(COMPONENT) # false
    MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
    SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
  ELSE(COMPONENT)
    SET(CMAKE_INSTALL_COMPONENT)
  ENDIF(COMPONENT)
ENDIF(NOT CMAKE_INSTALL_COMPONENT)
IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "DOC")
  FILE(...)
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "DOC")

Debugging this code, it appears "IF(NOT CMAKE_INSTALL_COMPONENT)" is true and "IF(COMPONENT)" is false. This means "CMAKE_INSTALL_COMPONENT" is set to empty. This again means "IF(NOT CMAKE_INSTALL_COMPONENT" will be true and the file(s) will be installed. 
So the problem seems to be rooted in the fact that "IF(COMPONENT)" is false. So who is responsible for setting the content of "COMPONENT" variable? 
Appreciate any help.
 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130902/f1dcceb7/attachment.htm>


More information about the CMake mailing list