[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.146 1.147 Configure.hxx.in 1.22 1.23 kwsysPlatformTestsCXX.cxx 1.4 1.5 testIOS.cxx 1.15 1.16

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Aug 31 13:00:57 EDT 2009


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv18988/Source/kwsys

Modified Files:
	CMakeLists.txt Configure.hxx.in kwsysPlatformTestsCXX.cxx 
	testIOS.cxx 
Log Message:
Define kwsys_ios_binary macro for std::ios::binary

The 'binary' openmode does not exist on all compilers.  We define macro
<kwsys>_ios_binary, where <kwsys> is the KWSys namespace, to refer to
std::ios::binary if it exists and 0 otherwise.  Sample usage:

  kwsys_ios::ifstream fin(fn, kwsys_ios::ios::in | kwsys_ios_binary);


Index: Configure.hxx.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/Configure.hxx.in,v
retrieving revision 1.22
retrieving revision 1.23
diff -C 2 -d -r1.22 -r1.23
*** Configure.hxx.in	14 Apr 2009 13:35:56 -0000	1.22
--- Configure.hxx.in	31 Aug 2009 17:00:55 -0000	1.23
***************
*** 33,36 ****
--- 33,39 ----
  #define @KWSYS_NAMESPACE at _IOS_USE_STRSTREA_H @KWSYS_IOS_USE_STRSTREA_H@
  
+ /* Whether C++ streams support the ios::binary openmode.  */
+ #define @KWSYS_NAMESPACE at _IOS_HAVE_BINARY @KWSYS_IOS_HAVE_BINARY@
+ 
  /* Whether STL is in std namespace.  */
  #define @KWSYS_NAMESPACE at _STL_HAVE_STD @KWSYS_STL_HAVE_STD@
***************
*** 64,67 ****
--- 67,77 ----
  #endif
  
+ /* Define the ios::binary openmode macro.  */
+ #if @KWSYS_NAMESPACE at _IOS_HAVE_BINARY
+ # define @KWSYS_NAMESPACE at _ios_binary @KWSYS_NAMESPACE at _ios::ios::binary
+ #else
+ # define @KWSYS_NAMESPACE at _ios_binary 0
+ #endif
+ 
  /* Whether the cstddef header is available.  */
  #define @KWSYS_NAMESPACE at _CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@
***************
*** 134,137 ****
--- 144,148 ----
  #  define kwsys_ios @KWSYS_NAMESPACE at _ios
  #  define kwsys     @KWSYS_NAMESPACE@
+ #  define kwsys_ios_binary @KWSYS_NAMESPACE at _ios_binary
  # endif
  # define KWSYS_NAME_IS_KWSYS            @KWSYS_NAMESPACE at _NAME_IS_KWSYS
***************
*** 142,145 ****
--- 153,157 ----
  # define KWSYS_IOS_USE_STRSTREAM_H      @KWSYS_NAMESPACE at _IOS_USE_STRSTREAM_H
  # define KWSYS_IOS_USE_STRSTREA_H       @KWSYS_NAMESPACE at _IOS_USE_STRSTREA_H
+ # define KWSYS_IOS_HAVE_BINARY          @KWSYS_NAMESPACE at _IOS_HAVE_BINARY
  # define KWSYS_STAT_HAS_ST_MTIM         @KWSYS_NAMESPACE at _STAT_HAS_ST_MTIM
  # define KWSYS_CXX_HAS_CSTDDEF          @KWSYS_NAMESPACE at _CXX_HAS_CSTDDEF

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/CMakeLists.txt,v
retrieving revision 1.146
retrieving revision 1.147
diff -C 2 -d -r1.146 -r1.147
*** CMakeLists.txt	27 Jul 2009 20:45:15 -0000	1.146
--- CMakeLists.txt	31 Aug 2009 17:00:55 -0000	1.147
***************
*** 448,451 ****
--- 448,456 ----
      "Checking whether stl string has istream operator>>" DIRECT)
  ENDIF(KWSYS_IOS_USE_ANSI AND NOT WATCOM)
+ SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
+   -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
+   -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_BINARY
+   "Checking whether ios has binary openmode" DIRECT)
  SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
  

Index: testIOS.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/testIOS.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** testIOS.cxx	6 Apr 2009 07:39:42 -0000	1.15
--- testIOS.cxx	31 Aug 2009 17:00:55 -0000	1.16
***************
*** 2,5 ****
--- 2,6 ----
  #include KWSYS_HEADER(stl/vector)
  #include KWSYS_HEADER(ios/sstream)
+ #include KWSYS_HEADER(ios/fstream)
  #include KWSYS_HEADER(ios/iostream)
  
***************
*** 10,13 ****
--- 11,15 ----
  # include "kwsys_stl_vector.h.in"
  # include "kwsys_ios_sstream.h.in"
+ # include "kwsys_ios_fstream.h.in"
  # include "kwsys_ios_iostream.h.in"
  #endif
***************
*** 143,146 ****
--- 145,155 ----
      }
  
+   // Just try to compile this.
+   if(x == 12345)
+     {
+     kwsys_ios::ifstream fin("/does_not_exist",
+                             kwsys_ios::ios::in | kwsys_ios_binary);
+     }
+ 
    kwsys_ios::cout << "IOS tests passed" << kwsys_ios::endl;
    return 0;

Index: kwsysPlatformTestsCXX.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/kwsysPlatformTestsCXX.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -C 2 -d -r1.4 -r1.5
*** kwsysPlatformTestsCXX.cxx	27 Jul 2009 20:45:15 -0000	1.4
--- kwsysPlatformTestsCXX.cxx	31 Aug 2009 17:00:55 -0000	1.5
***************
*** 295,298 ****
--- 295,309 ----
  #endif
  
+ #ifdef TEST_KWSYS_IOS_HAVE_BINARY
+ int test_binary(int, ...)
+ {
+   return 0;
+ }
+ int main()
+ {
+   return test_binary(1, kwsys_ios::ios::binary);
+ }
+ #endif
+ 
  #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  int test_istream(kwsys_ios::istream& is, long long& x)



More information about the Cmake-commits mailing list