MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0014850 | CMake | CMake | public | 2014-03-30 11:42 | 2016-06-10 14:31 |
Reporter | toeb | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | feature | Reproducibility | have not tried |
Status | closed | Resolution | moved | ||
Platform | OS | OS Version | |||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0014850: Overriding function with a macro should either be turned off or usefull. | ||||
Description | consider the following code valid cmake code which currently fails at execution: macro(function) _function(${ARGN} message("function called: ${ARGN}) endmacro() function(test_func) endfunction() test_func() this fails because _function does not have a corresponding end_function() It would be very cool however if the behaviour could be changed for this special case (also redefining end_function or all commands that are of begin() end() form) or more generally allowing begin/end constructs to span through macros (maybe with a policy? or an extra function?) it would allow for very cool tricks and would almost certainly not break any existing cmake projects with this single feature cmake could be extended by clean object oriented programming paradigms, it would allow hierarchical logging, and aspect oriented programming paradigms as well. In my case I want to do the following (return value): macro(return) set(__result ${ARGN} PARENT_SCOPE) _return() endmacro() function(tmp_fu) return(hello) endfunction() function(tmp_fu2) endfunction() tmp_fu() message(${__result}) tmp_fu2() # result is still the same as before because it is not cleared when function is called. # what would help is this redefinition for function (which does not work): # because it would execute set(__result PARENT_SCOPE) before every function execution macro(function) _function($ARGN) set(__result PARENT_SCOPE) endmacro() I have already implemented Object oriented cmake (https://github.com/toeb/oo-cmake [^]) - the documentation is currently a bit off (it is much more powerfull already) but this one limitation is missing to make oo-cmake a almost lean oo-programming language. tell me if this makes sense to you | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2014-03-30 11:42 | toeb | New Issue | |||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042522 | |||
2016-06-10 14:29 | Kitware Robot | Status | new => resolved | ||
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|