[Cmake-commits] [cmake-commits] hoffman committed CMakeLists.txt 1.36.2.1 1.36.2.2 gen_redirect_in.c NONE 1.1.2.2 generator.cxx 1.3 1.3.18.1 tcat.cxx NONE 1.1.2.2

cmake-commits at cmake.org cmake-commits at cmake.org
Thu May 1 12:35:42 EDT 2008


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

Modified Files:
      Tag: CMake-2-6
	CMakeLists.txt generator.cxx 
Added Files:
      Tag: CMake-2-6
	gen_redirect_in.c tcat.cxx 
Log Message:
ENH: merge from cvs create yikes RC 10! (I hope this is the last RC...)


--- 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.36.2.1
retrieving revision 1.36.2.2
diff -C 2 -d -r1.36.2.1 -r1.36.2.2
*** CMakeLists.txt	25 Mar 2008 23:59:00 -0000	1.36.2.1
--- CMakeLists.txt	1 May 2008 16:35:40 -0000	1.36.2.2
***************
*** 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,200 ****
  ADD_SUBDIRECTORY(GeneratorInExtraDir)
  
  
  ##############################################################################
  # Test non-trivial command line arguments in custom commands.
  SET(EXPECTED_ARGUMENTS)
- # TODO: Check shell operators < > << >> | 2>&1 1>&2 &> ! &
  SET(CHECK_ARGS
    c:/posix/path
--- 193,211 ----
  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
+   )
  
  ##############################################################################
  # Test non-trivial command line arguments in custom commands.
  SET(EXPECTED_ARGUMENTS)
  SET(CHECK_ARGS
    c:/posix/path
***************
*** 203,207 ****
    single'quote
    \"double-quotes\"
-   double\"quote
    "\\;semi-colons\\;"
    "semi\\;colon"
--- 214,217 ----
***************
*** 214,220 ****
    {lcurly}
    rcurly}
!   #<angle> # angle-brackets are inconsistent on windows right now
!   #<langle
!   #rangle>
    [square]
    [lsquare # these have funny behavior due to special cases for
--- 224,230 ----
    {lcurly}
    rcurly}
!   <angle>
!   <langle
!   rangle>
    [square]
    [lsquare # these have funny behavior due to special cases for
***************
*** 222,226 ****
    $dollar-signs$
    dollar$sign
!   &ampersands&
    one&ampersand
    @two-ats@
--- 232,236 ----
    $dollar-signs$
    dollar$sign
!   &ampersands&x # Borland make does not like trailing ampersand
    one&ampersand
    @two-ats@
***************
*** 257,261 ****
    "single'quote with space"
    "\"double-quotes with space\""
-   "double\"quote with space"
    "\\;semi-colons w s\\;"
    "semi\\;colon w s"
--- 267,270 ----
***************
*** 268,274 ****
    "{lcurly w s"
    "rcurly} w s"
!   #"<angle> w s" # angle-brackets are inconsistent on windows right now
!   #"<langle w s"
!   #"rangle> w s"
    "[square] w s"
    "[lsquare w s" # these have funny behavior due to special cases for
--- 277,283 ----
    "{lcurly w s"
    "rcurly} w s"
!   "<angle> w s"
!   "<langle w s"
!   "rangle> w s"
    "[square] w s"
    "[lsquare w s" # these have funny behavior due to special cases for
***************
*** 304,311 ****
    "#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.
    )
  IF(NOT MINGW)
--- 313,317 ----
    "#two-pounds# w s"
    "one#pound w s"
!   ~ ` ! @ \# $ % ^ & _ - + = : "\;" \" ' , . ? "(" ")" { } []
    )
  IF(NOT MINGW)
***************
*** 314,317 ****
--- 320,337 ----
    LIST(APPEND CHECK_ARGS * /)
  ENDIF(NOT MINGW)
+ 
+ # The windows command shell does not support a double quote by itself:
+ #   double\"quote
+ # without messing up quoting of arguments following it.
+ 
+ # Make tools need help with escaping a single backslash
+ #   \
+ # at the end of a command because they think it is a continuation
+ # character.
+ 
+ # We now have special cases for shell operators:
+ #   | < > << >> &> 2>&1 1>&2
+ # to allow custom commands to perform redirection.
+ 
  FOREACH(arg ${CHECK_ARGS})
    SET(ARG "${arg}")

Index: generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CustomCommand/generator.cxx,v
retrieving revision 1.3
retrieving revision 1.3.18.1
diff -C 2 -d -r1.3 -r1.3.18.1
*** generator.cxx	27 Apr 2004 15:08:58 -0000	1.3
--- generator.cxx	1 May 2008 16:35:40 -0000	1.3.18.1
***************
*** 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