[cmake-developers] [CMake 0012908]: Emacs cmake mode indents incorrectly after multiline SET()

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 23 13:31:08 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12908 
====================================================================== 
Reported By:                Christopher Sean Morrison
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12908
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-01-23 13:31 EST
Last Modified:              2012-01-23 13:31 EST
====================================================================== 
Summary:                    Emacs cmake mode indents incorrectly after multiline
SET()
Description: 
Summary says it all.  If you define a macro that calls set, it will think the
previous line indentation was at that unindented level.  See the example in the
Steps to Reproduce section.

Fortunately, it seems a fix was easy.  See attached.

Steps to Reproduce: 
Indenting this region results in the lines after the DIRNAME_SRC set line all
being at beginning of line.

MACRO(BRLCAD_CHECK_DIRNAME)
  SET(DIRNAME_SRC "
#include <libgen.h>
int main(int argc, char *argv[]) {
(void)dirname(argv[0]);
return 0;
}")
  CHECK_C_SOURCE_RUNS("${DIRNAME_SRC}" HAVE_DIRNAME)
  IF(HAVE_DIRNAME)
    FILE(APPEND ${CONFIG_H_FILE} "#define HAVE_DIRNAME 1\n")
  ENDIF(HAVE_DIRNAME)
ENDMACRO(BRLCAD_CHECK_DIRNAME var)


Additional Information: 
Conveniently, there was already a cmake-line-starts-inside-string() function we
could key off of, so we keep walking backwards until we find an actual statement
inside cmake-find-last-indented-line().

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-01-23 13:31 Christopher Sean MorrisonNew Issue                             
      
2012-01-23 13:31 Christopher Sean MorrisonFile Added:
cmake-mode-set-indent.patch                    
======================================================================




More information about the cmake-developers mailing list