diff options
author | Brad King <brad.king@kitware.com> | 2005-04-15 20:00:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2005-04-15 20:00:44 (GMT) |
commit | bddade9696d8fec453f9ce79168ad5aa678290ab (patch) | |
tree | ceb606dd6b7b492367a3e66606e730fa2c4ee79b /Source | |
parent | cc996274f8c00f2651e260d1a6828c8877c4e2bd (diff) | |
download | CMake-bddade9696d8fec453f9ce79168ad5aa678290ab.zip CMake-bddade9696d8fec453f9ce79168ad5aa678290ab.tar.gz CMake-bddade9696d8fec453f9ce79168ad5aa678290ab.tar.bz2 |
COMP: Added KWSYS_CXX_HAS_CSTDDEF try-compile to KWSys to provide kwsys/cstddef header (to get size_t for hash_fun.hxx).
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Source/kwsys/Configure.hxx.in | 4 | ||||
-rw-r--r-- | Source/kwsys/hash_fun.hxx.in | 2 | ||||
-rw-r--r-- | Source/kwsys/hashtable.hxx.in | 1 | ||||
-rw-r--r-- | Source/kwsys/kwsysPlatformCxxTests.cxx | 6 | ||||
-rw-r--r-- | Source/kwsys/kwsys_cstddef.hxx.in | 37 |
6 files changed, 58 insertions, 0 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index f77d3a0..a1e12bb 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -178,6 +178,9 @@ ELSE(KWSYS_IOS_USE_SSTREAM) ENDIF(KWSYS_IOS_USE_STRSTREAM_H) ENDIF(KWSYS_IOS_USE_SSTREAM) +KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDDEF + "Checking whether header cstddef is available" DIRECT) + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}) KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_NEQ_CHAR @@ -294,6 +297,11 @@ FOREACH(header algorithm deque iterator list map numeric queue set stack string ENDIF(KWSYS_HEADER_INSTALL_DIR) ENDFOREACH(header) +# Provide cstddef header. +CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_cstddef.hxx.in + ${KWSYS_HEADER_DIR}/cstddef + @ONLY IMMEDIATE) + #----------------------------------------------------------------------------- # Create streams header wrappers to give standard names by which they # may be included. diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in index 5b9268c..b599388 100644 --- a/Source/kwsys/Configure.hxx.in +++ b/Source/kwsys/Configure.hxx.in @@ -63,6 +63,9 @@ # define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios #endif +/* Whether the cstddef header is available. */ +#define @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@ + /* Whether the compiler supports null template arguments. */ #define @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS @KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@ @@ -133,6 +136,7 @@ # define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H # define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H # define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM +# define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF # define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM # define KWSYS_STL_STRING_HAVE_ISTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM # define KWSYS_STL_STRING_HAVE_NEQ_CHAR @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in index f40750e..59f445c 100644 --- a/Source/kwsys/hash_fun.hxx.in +++ b/Source/kwsys/hash_fun.hxx.in @@ -41,6 +41,8 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> +#include <@KWSYS_NAMESPACE@/cstddef> // size_t + namespace @KWSYS_NAMESPACE@ { diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in index 061862a..af0ec5f 100644 --- a/Source/kwsys/hashtable.hxx.in +++ b/Source/kwsys/hashtable.hxx.in @@ -41,6 +41,7 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> +#include <@KWSYS_NAMESPACE@/cstddef> // size_t #include <@KWSYS_NAMESPACE@/stl/algorithm> // lower_bound #include <@KWSYS_NAMESPACE@/stl/functional> // unary_function #include <@KWSYS_NAMESPACE@/stl/iterator> // iterator_traits diff --git a/Source/kwsys/kwsysPlatformCxxTests.cxx b/Source/kwsys/kwsysPlatformCxxTests.cxx index a8b3d6f..44c0432 100644 --- a/Source/kwsys/kwsysPlatformCxxTests.cxx +++ b/Source/kwsys/kwsysPlatformCxxTests.cxx @@ -59,6 +59,12 @@ bool f(const kwsys_stl::string& s) { return s != ""; } int main() { return 0; } #endif +#ifdef TEST_KWSYS_CXX_HAS_CSTDDEF +#include <cstddef> +void f(size_t) {} +int main() { return 0; } +#endif + #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS template <class T> class A; template <class T> int f(A<T>&); diff --git a/Source/kwsys/kwsys_cstddef.hxx.in b/Source/kwsys/kwsys_cstddef.hxx.in new file mode 100644 index 0000000..3c951ec --- /dev/null +++ b/Source/kwsys/kwsys_cstddef.hxx.in @@ -0,0 +1,37 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + + Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef @KWSYS_NAMESPACE@_cstddef +#define @KWSYS_NAMESPACE@_cstddef + +#include <@KWSYS_NAMESPACE@/Configure.hxx> + +/* Avoid warnings in MSVC standard headers. */ +#ifdef _MSC_VER +# pragma warning (push, 1) +# pragma warning (disable: 4702) +# pragma warning (disable: 4786) +#endif + +/* Include the real header. */ +#if @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF +# include <cstddef> +#else +# include <stddef.h> +#endif + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +#endif |