[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.37 1.38 gen_redirect_in.c NONE 1.1 generator.cxx 1.3 1.4 tcat.cxx NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Apr 29 15:34:51 EDT 2008


Update of /cvsroot/CMake/CMake/Tests/CustomCommand
In directory public:/mounts/ram/cvs-serv24979/Tests/CustomCommand

Modified Files:
	CMakeLists.txt generator.cxx 
Added Files:
	gen_redirect_in.c tcat.cxx 
Log Message:
BUG: Do not escape shell operators when generating command lines.

  - See bug#6868.
  - Update CustomCommand test to check.


--- NEW FILE: tcat.cxx ---
#include <stdio.h>

int main()
{
  int c;
  while((c = getc(stdin), c != EOF))
    {
    putc(c, stdout);
    }
  return 0;
}

--- NEW FILE: gen_redirect_in.c ---
#if 1

int gen_redirect() { return 3; }

/* endif should be concatenated to generated file */

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CustomCommand/CMakeLists.txt,v
retrieving revision 1.37
retrieving revision 1.38
diff -C 2 -d -r1.37 -r1.38
*** CMakeLists.txt	25 Mar 2008 15:26:50 -0000	1.37
--- CMakeLists.txt	29 Apr 2008 19:34:37 -0000	1.38
***************
*** 151,154 ****
--- 151,155 ----
    ${PROJECT_BINARY_DIR}/generated.c
    ${PROJECT_BINARY_DIR}/not_included.h
+   gen_redirect.c # default location for custom commands is in build tree
    )
  
***************
*** 192,195 ****
--- 193,207 ----
  ADD_SUBDIRECTORY(GeneratorInExtraDir)
  
+ ##############################################################################
+ # Test shell operators in custom commands.
+ 
+ ADD_EXECUTABLE(tcat tcat.cxx)
+ 
+ ADD_CUSTOM_COMMAND(OUTPUT gen_redirect.c
+   DEPENDS tcat gen_redirect_in.c
+   COMMAND tcat < ${CMAKE_CURRENT_SOURCE_DIR}/gen_redirect_in.c > gen_redirect.c
+   COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> gen_redirect.c
+   VERBATIM
+   )
  
  ##############################################################################
***************
*** 304,309 ****
    "#two-pounds# w s"
    "one#pound w s"
!   ~ ` ! @ \# $ % ^ & _ - + = | : "\;" \" ' , . ? "(" ")" { } []
! #  < > << >> &> 2>&1 1>&2
  # \\ # Need to test last to avoid ; escape in list.
  #    # Make tools need help when this is the last argument.
--- 316,321 ----
    "#two-pounds# w s"
    "one#pound w s"
!   ~ ` ! @ \# $ % ^ & _ - + = : "\;" \" ' , . ? "(" ")" { } []
! # | < > << >> &> 2>&1 1>&2
  # \\ # Need to test last to avoid ; escape in list.
  #    # Make tools need help when this is the last argument.

Index: generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CustomCommand/generator.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** generator.cxx	27 Apr 2004 15:08:58 -0000	1.3
--- generator.cxx	29 Apr 2008 19:34:37 -0000	1.4
***************
*** 9,14 ****
      }
    FILE *fp = fopen(argv[1],"w");
!   
    fprintf(fp,"int generated() { return 3; }\n");
    fclose(fp);
    return 0;
--- 9,18 ----
      }
    FILE *fp = fopen(argv[1],"w");
! #ifdef GENERATOR_EXTERN
    fprintf(fp,"int generated() { return 3; }\n");
+ #else
+   fprintf(fp,"extern int gen_redirect(void);\n");
+   fprintf(fp,"int generated() { return gen_redirect(); }\n");
+ #endif
    fclose(fp);
    return 0;



More information about the Cmake-commits mailing list