Is there a way to control the list of files installed? when “make install” occurs?
A) I have an embedded target - so nothing really gets installed.
Instead my CI/CD process says: put all important files in THIS directory.
B) I know that name of files - these are hex files, elf files and a few others
I have them in a LIST called: ARTIFACTS_LIST -
C) As a post build step - I need to “quasi-install” them
but the CMAKE install process thinks things go in: /usr/local/whatever.
No No and Absolutly No CMAKE has it wrong very wrong.
The files go where I want them to go and nowhere else.
and there shall be nothing other then the files I specify in that directory.
====
stated differently:
I create a ELF executable as the main build target.
From that ELF - I create a bin, a hex file, a C and H file, a symbol table, a map file etc.
Some are created via a post build event (I have 5 steps) post elf file
I have the complete lists of files that need to be pushed to the ARTIFACTS directory
how do I do that.?
ClausKlein
(Claus Klein)
August 19, 2024, 4:52am
2
CMake install what and to the destination directory you are able to control in your project files and by using the right command line options. See too CMAKE_SKIP_INSTALL_RULES
i.e.:
cmake -G Ninja -B build -S . -D CMAKE_INSTALL_PREFIX=/tmp/test
and use COMPONENT option in your install configuration, i.e:
install(TARGETS MyShared MyStatic
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT MyProj_Runtime
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT MyProj_Runtime
NAMELINK_COMPONENT MyProj_Development
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT MyProj_Development
)
Ok - I see how to specify the INSTALL directory.
And how to disable generation of the cmake install cmake file
But how do I control WHAT files are installed and/or NOT placed in that directory?
aka: I have a list of files that should be installed and I only want that list of files installed. (copied to the installation directory)
hsattler
(Hendrik Sattler)
August 19, 2024, 6:40pm
4
Well, just the things that are defined by INSTALL() commands are installed.
You define the relative or absolute destinations.
You can specify an explicit base install directory if you choose the usual preferred relative destinations.
You can define components (groups of installed files).
All of this has to be explicitly written by you. And if you think differently, you can just not use it but your own scripts instead.
So what’s the matter?
so what’s the matter?
You can define components (groups of installed files).
How do I do that?
I have a list of files created with list(APPEND …)
Those are the only files that should be placed in the install directory.
No other files. No sub directories… etc
In bash, it is as simple as:
for X in LIST_OF_FILES
do
cp $X ${INSTALL_DIR}
done
CMAKE makes this sort of very confusing on how to accomplish In my opinion a simple task.
Nothing is straight forward.
retif
August 19, 2024, 9:10pm
6
control the list of files installed
I have them in a LIST called: ARTIFACTS_LIST
Those are the only files that should be placed in the install directory
No other files
No sub directories
Then do so , why don’t you:
list(APPEND ARTIFACTS_LIST
"${CMAKE_CURRENT_SOURCE_DIR}/etc/1.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/etc/2.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/etc/3.txt"
)
install(
FILES ${ARTIFACTS_LIST}
DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/install" # or "${CMAKE_INSTALL_PREFIX}" # or "/path/to/wherever/is/your/install"
)
Instead my CI/CD process says: put all important files in THIS directory
“What the hell is even that”. ©