diff options
author | Brad King <brad.king@kitware.com> | 2014-01-02 19:23:35 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-01-02 19:23:35 (GMT) |
commit | fef56edee777b69716bd288d453c1263c0a291ef (patch) | |
tree | 40396376927cde8abc3e88baf3a16690555c84b0 | |
parent | f6c85e7b3672364de4a59b18d04a463b68dd4c00 (diff) | |
parent | 2f7c1691580a08b53eef63411c93f59121d95397 (diff) | |
download | CMake-fef56edee777b69716bd288d453c1263c0a291ef.zip CMake-fef56edee777b69716bd288d453c1263c0a291ef.tar.gz CMake-fef56edee777b69716bd288d453c1263c0a291ef.tar.bz2 |
Merge topic 'update-kwsys'
2f7c169 Merge branch 'upstream-kwsys' into update-kwsys
d4efa5f KWSys 2013-12-21 (e81f2a9e)
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Source/kwsys/FStream.hxx.in | 5 | ||||
-rw-r--r-- | Source/kwsys/testFStream.cxx | 48 |
3 files changed, 56 insertions, 2 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 3745f78..24ea518 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1136,6 +1136,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) testEncoding ) ENDIF(KWSYS_STL_HAS_WSTRING) + IF(KWSYS_USE_FStream) + SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} + testFStream + ) + ENDIF(KWSYS_USE_FStream) IF(KWSYS_USE_SystemInformation) SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation) ENDIF(KWSYS_USE_SystemInformation) diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in index c340c55..916a93e 100644 --- a/Source/kwsys/FStream.hxx.in +++ b/Source/kwsys/FStream.hxx.in @@ -25,8 +25,9 @@ namespace @KWSYS_NAMESPACE@ typedef std::basic_filebuf<CharType,Traits> my_base_type; basic_filebuf *open(char const *s,std::ios_base::openmode mode) { - my_base_type::open(Encoding::ToWide(s).c_str(), mode); - return this; + return static_cast<basic_filebuf*>( + my_base_type::open(Encoding::ToWide(s).c_str(), mode) + ); } }; diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx new file mode 100644 index 0000000..8942549 --- /dev/null +++ b/Source/kwsys/testFStream.cxx @@ -0,0 +1,48 @@ +/*============================================================================ + KWSys - Kitware System Library + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "kwsysPrivate.h" + +#if defined(_MSC_VER) +# pragma warning (disable:4786) +#endif + +#include KWSYS_HEADER(FStream.hxx) + +// Work-around CMake dependency scanning limitation. This must +// duplicate the above list of headers. +#if 0 +# include "FStream.hxx.in" +#endif + + +//---------------------------------------------------------------------------- +static int testNoFile() +{ + kwsys::ifstream in_file("NoSuchFile.txt"); + if(in_file) + { + return 1; + } + + return 0; +} + + +//---------------------------------------------------------------------------- +int testFStream(int, char*[]) +{ + int ret = 0; + + ret |= testNoFile(); + + return ret; +} |