I have a project structured like below:
\build
\deps
\src
CMakeLists.txt
clean.cmake
There are some library dependencies located in deps. All these libraries have CMake install command.
After install, the output files will be put in build directory:
\build\fin\bin
\build\fin\lib
\build\fin\include
In my case, I will run cmake package to generate a binary install package, it generates something similar in _CPack_Packages.
The problem is I don't need lib and include to be included in the binary. But I haven't found a solution yet.
I tried the following methods:
CPACK_SOURCE_IGNORE_FILESandCPACK_SOURCE_STRIP_FILES.
These are for packaging the source I think, not working for my case.
- Use post install script
instal(SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/clean.cmake")to remove the unnecessary files/dirs.
In clean.cmake, if(EXISTS "${CMAKE_INSTALL_PREFIX}/bin/ProjectA.lib") returned FALSE, there is nothing in the ${CMAKE_INSTALL_PREFIX} directory when the script was running, but I can find the files after it finished.
- Try to modify
install_manifest.txt. I haven't found a way to access this file correctly. I'm not sure this would work.
Thank you for your help!
Edit:
The install command like below:
install(TARGETS ${INS_TARGETS}
RUNTIME DESTINATION bin COMPONENT applications
LIBRARY DESTINATION lib COMPONENT libraries
ARCHIVE DESTINATION lib COMPONENT libraries
)
Try to use component install.
Add component label for each
installcommand:Turn on component install in CPack and list components you want to install:
More information : http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack