[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.18 1.18.2.1 expect_arg.c NONE 1.1.2.2

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Nov 3 17:25:32 EST 2009


Update of /cvsroot/CMake/CMake/Tests/TryCompile
In directory public:/mounts/ram/cvs-serv14310/Tests/TryCompile

Modified Files:
      Tag: CMake-2-8
	CMakeLists.txt 
Added Files:
      Tag: CMake-2-8
	expect_arg.c 
Log Message:
CMake 2.8.0-rc5


--- NEW FILE: expect_arg.c ---
#include <stdio.h>
#include <string.h>
int main(int ac, char*av[])
{
  int i;
  printf("ac = [%d]\n", ac);
  for(i =0; i < ac; i++)
    {
    printf("arg[%d] = %s\n", i, av[i]);
    }
  if(ac == 3)
    {
    if(strcmp(av[1], "arg1") ==0 
       && strcmp(av[2], "arg2") ==0)
      {
      printf("arg1 and arg2 present and accounted for!\n");
      return 0;
      }
    }
  printf("arg1 and arg2 missing!\n");
  return -1;
}

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/TryCompile/CMakeLists.txt,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -C 2 -d -r1.18 -r1.18.2.1
*** CMakeLists.txt	18 Sep 2009 13:49:51 -0000	1.18
--- CMakeLists.txt	3 Nov 2009 22:25:20 -0000	1.18.2.1
***************
*** 143,146 ****
--- 143,157 ----
  ENDIF(NOT "${TRY_OUT}" MATCHES "hello world")
  
+ TRY_RUN(ARG_TEST_RUN ARG_TEST_COMPILE
+     ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp  
+     ${TryCompile_SOURCE_DIR}/expect_arg.c
+     OUTPUT_VARIABLE TRY_OUT
+     ARGS arg1 arg2)
+ IF(NOT ARG_TEST_COMPILE)
+   MESSAGE(SEND_ERROR "expect_arg failed compiling: ${TRY_OUT}")
+ ENDIF(NOT ARG_TEST_COMPILE)
+ IF(NOT "${ARG_TEST_RUN}" STREQUAL "0")
+   MESSAGE(SEND_ERROR "expect_arg failed running with exit code ${ARG_TEST_RUN} ${TRY_OUT}")
+ ENDIF(NOT "${ARG_TEST_RUN}" STREQUAL "0")
  
  # try to run a file that should compile and run, but return an error



More information about the Cmake-commits mailing list