MantisBT - CMake
View Issue Details
0013005CMakeCMakepublic2012-02-29 13:352016-06-10 14:31
Jérôme Gardou 
Kitware Robot 
normalfeatureN/A
closedmoved 
CMake 2.8.7 
 
0013005: Add PRECOMPILE_RULE and POSTCOMPILE_RULE source property
Hello.

For finer control of our build process, we sometimes need to add some supplementary commands for some specific files. Although add_custom_command is great, it's not enough for our purpose.

The documentation says it all, and the implementation is really straightforward.
I only added this for the MakeFile generator, as we don't really support anything else, and I'm not familiar enough with other code portions of cmake.

It also ensures that the compilation depends on those rules.

Regards.
Jérôme
The functionality can be tested with the following:
cmake_minimum_required(VERSION 2.6)

add_library(test test1.c test2.c)

set_source_files_properties(test1.c test2.c PROPERTIES PRECOMPILE_RULE "echo <SOURCE> will be compiled there: <OBJECT>"
    POSTCOMPILE_RULE "echo <SOURCE> was compiled with flags <FLAGS> and defines <DEFINES>")
No tags attached.
diff PRE-POSTCOMPILE_RULE.diff (4,280) 2012-02-29 13:35
https://public.kitware.com/Bug/file/4239/PRE-POSTCOMPILE_RULE.diff
Issue History
2012-02-29 13:35Jérôme GardouNew Issue
2012-02-29 13:35Jérôme GardouFile Added: PRE-POSTCOMPILE_RULE.diff
2012-02-29 14:57Brad KingNote Added: 0028762
2012-08-11 21:09David ColeStatusnew => backlog
2012-08-11 21:09David ColeNote Added: 0030370
2016-06-10 14:28Kitware RobotNote Added: 0041993
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0028762)
Brad King   
2012-02-29 14:57   
This is an interesting feature, but it can't possibly be implemented for the Xcode and VS generators. Are you familiar with the RULE_LAUNCH_COMPILE property? It is only for Makefiles and is used by CTest to instrument compiler invocations. A better name for the proposed properties may be RULE_PRE_COMPILE and RULE_POST_COMPILE to be consistent with the other RULE_* properties.

What is your use case for which add_custom_command is not enough?
(0030370)
David Cole   
2012-08-11 21:09   
Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041993)
Kitware Robot   
2016-06-10 14:28   
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.