PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, June 29, 2022

[FIXED] How to add multiple comments in add_custom_command of CMake?

 June 29, 2022     cmake, cmake-custom-command, comments     No comments   

Issue

This question is just out of curiosity as I noticed that only the last comment block was being printed.

add_custom_command(
 TARGET target_a
 POST_BUILD
 COMMAND command_A_to_do_something
 COMMENT "Comment A"
 COMMAND command_B_to_do_something_else
 COMMENT "Comment B"
)

Only "Comment B" is printed on the console. For this reason, I ended up splitting multiple commands to multiple add_custom_command blocks. Any ideas of how to get all comments printed?

Using CMake v3.5.2


Solution

I do this with CMake's command line abstraction for echo:

add_custom_command(
  TARGET target_a
  POST_BUILD
  COMMAND command_A_to_do_something
  COMMAND ${CMAKE_COMMAND} -E echo "Comment A"
  COMMAND command_B_to_do_something_else
  COMMAND ${CMAKE_COMMAND} -E echo "Comment B"
)


Answered By - Florian
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing