A mechanism in CMake allowing users to define build steps other than compiling libraries and linking executables, supporting a more generalized concept of a build. Involves the add_custom_command and add_custom_target commands.
Questions tagged [cmake-custom-command]
104 questions
0
votes
1 answer
add_custom_command for copy *.y to *.txt file
I am trying to copy the generated *.y output (plane luma values, no header info) to text file using the add_custom_command CMake command. How can I add the copy command in add_custom_command?
I want to redirect the generated *.y output to text file.…

jailaxmi k
- 89
- 3
- 11
0
votes
0 answers
CMAKE custom compiler not overwriting
In a CMAKE project, I need to define a custom command for a file type (.osl) which is compiled by a tool (oslc) which compiles to another file type (.oso)
I managed to do it by a function that I can run on a list of source…

galinette
- 8,896
- 2
- 36
- 87
0
votes
0 answers
What is the best way to properly add a custom command in the generated Makefile by using CMake?
I would like to use a CMakeLists.txt file to generate a Makefile with specific custom commands to use them in a terminal like this :
$> make command1
...
$> make command2
...
I have looked for add_custom_command but I don't want to generate an…

Sunchock
- 361
- 4
- 14
0
votes
0 answers
add_custom_command for copy header files not working
This is my project tree-like format :
├── cmake
│ └── CopyHeaderFiles.cmake
├── CMakeLists.txt
├── common
│ ├── CMakeLists.txt
│ ├── Headers
│ │ ├── CMakeLists.txt
│ │ ├── criticalmessage.h
│ …

HP_perfect
- 95
- 1
- 11
0
votes
1 answer
CMAKE add_custom_command still confusing
I reviewed the response for using the add_custom_command for cmake and was not able to get it to work in android studio. I am having trouble finding the target when run.
add_custom_command( TARGET b.c.o
POST_BUILD
…

Tony Skyviper
- 1
- 3
0
votes
1 answer
How to parameterize cmake add_custom_command and add_custom_target?
I'm creating a library for micro-controller which as part of it's source will have couple of usage examples.
All CMakeList.txt files for the examples look very similar:
set(ESP_TARGET_FW1…

rzajac
- 1,591
- 2
- 18
- 37
0
votes
1 answer
add_custom_command after running a test (CMakeLists)
I'm using a CMakeLists.txt file to generate (among others) some tests. Therefore I have something like
ENABLE_TESTING()
ADD_TEST(NAME my_name COMMAND my_command)
I'd like to add somme commands after the test is run. I found ADD_CUSTOM_COMMAND which…

Ezor
- 135
- 2
- 18
0
votes
2 answers
add_custom_command on xml files
our system uses some xml files to generate some code. So I've created a custom command to scan and parse these files, and generate stuff as accorded. This is what I did:
file(GLOB BEAN_XML_FILES "../../*.xml")
add_custom_command(TARGET…

scooterman
- 1,336
- 2
- 17
- 36
0
votes
1 answer
Force CMake add_custom_commands to not take mouse/keybouard focus on Mac OS X
Our build contains a lot of tests run as part of the build process to ensure nothing important is broken by someone's changes. These are simple commandline applications, no GUI.
On Mac OS X, when building from within Qt Creator, each of these…

rubenvb
- 74,642
- 33
- 187
- 332
0
votes
1 answer
Running cscope from CMake at build time
I'm using Ubuntu Linux.
I've been trying to get the following cscope command to run when I run "make" from my project directory, so it recompiles cscope and gets updated name information when I make my project.
cscope -b -q -U -R
Per my research and…

Tony The Lion
- 61,704
- 67
- 242
- 415
0
votes
1 answer
cmake bind custom command to a existed top level target fails
I want to have one top level custom target, and nested submodules which are able to extend this already existed target by adding/binding custom_command to it. For now I face a problem: if add_custom_command(TARGET target_name ...) is used not in a…
0
votes
1 answer
Conditional add_custom_command in CMake
I am using a macro to create precompiled headers for my cmake project. For gcc, this macro uses add_custom_command to create a *.h.gch file which can then be added to the target along with the other source files with add_executable/add_library. The…

Moritz
- 4,565
- 2
- 23
- 21
-1
votes
1 answer
add_custom_command not working
I am trying to understand add_custom_command usage, I wrote a minimal make file (CMakeLists.txt)
like shown below
When I run the make file using
$cmake.
$make
I don't see perfecthash.cpp being created and the build breaks…

Sri Kant
- 169
- 1
- 12
-2
votes
0 answers
Compile text file to object
I'm using CMake and would like to compile a text file into an object file.
eg. I have a text file containing "hello\nworld\n". I would like this to compile to an object as if this file were in fact a C++ file:
char * myString = "hello\n\world\n";
Is…

An Fuel
- 67
- 3