MantisBT - CMake
View Issue Details
0005436CMakeCMakepublic2007-07-31 06:582016-06-10 14:30
Yegor Yefremov 
Bill Hoffman 
lowminoralways
closedmoved 
 
 
0005436: ADD_CUSTOM_COMMAND unused custom commands are not reported to the user
If add_custom_command is placed before the target itself, there is no warning or error message, when executing "cmake .". The custom target will not created, when executing make. As soon as add_custom_target is placed after the target itself, the custom target will be created.

The following CMakeLists.txt was used to test this behavior (test.c is also attached):

project (TEST)

# sources
set (SRCS test.c)

#custom target
add_custom_command (TARGET test POST_BUILD COMMENT "Creating tags" COMMAND mkdir tags WORKING_DIRECTORY ${TEST_SOURCE_DIR})

# executables
add_executable (test ${SRCS})
From Brad King:

In cmMakefile::AddCustomCommandToTarget, this code appears:

  // Find the target to which to add the custom command.
  cmTargets::iterator ti = this->Targets.find(target);
  if(ti != this->Targets.end())
    {
    ...
    }

There is no else block. There should be an else block that uses
IssueMessage to complain that the target doesn't exist. You'll have to
create a policy to make this an error.
No tags attached.
c test.c (95) 1969-12-31 19:00
https://public.kitware.com/Bug/file/1084/test.c
Issue History
2008-10-10 10:36Bill HoffmanSummaryADD_CUSTOM_COMMAND no dependencies check => ADD_CUSTOM_COMMAND unused custom commands are not reported to the user
2008-10-10 10:36Bill HoffmanAdditional Information Updated
2016-06-10 14:27Kitware RobotNote Added: 0041378
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0041378)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.