2003-06-20 02:57:11 +04:00
#=============================================================================
#
# Program: KWSys - Kitware System Library
# Module: $RCSfile$
#
2003-12-16 23:38:36 +03:00
# Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
# See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
2003-06-20 02:57:11 +04:00
#
2003-12-08 19:35:34 +03:00
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
2003-06-20 02:57:11 +04:00
# PURPOSE. See the above copyright notices for more information.
#
#=============================================================================
# The Kitware System Library is intended to be included in other
# projects. It is completely configurable in that the library's
2003-06-26 21:39:35 +04:00
# namespace can be configured and the components that are included can
# be selected invididually.
2003-06-20 02:57:11 +04:00
# Typical usage is to import the kwsys directory tree into a
2003-06-26 21:39:35 +04:00
# subdirectory under a parent project and enable the classes that will
# be used. All classes are disabled by default. The CMake listfile
# above this one configures the library as follows:
2003-06-20 02:57:11 +04:00
#
2003-06-26 21:39:35 +04:00
# SET(KWSYS_NAMESPACE foosys)
# SET(KWSYS_USE_Directory 1) # Enable Directory class.
2003-06-20 02:57:11 +04:00
# SUBDIRS(kwsys)
#
# Optional settings are as follows:
#
2003-06-20 22:10:28 +04:00
# KWSYS_HEADER_ROOT = The directory into which to generate the kwsys headers.
# A directory called "${KWSYS_NAMESPACE}" will be
# created under this root directory to hold the files.
2003-06-20 02:57:11 +04:00
#
# Example:
#
2003-07-08 17:21:45 +04:00
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
2003-06-20 02:57:11 +04:00
#
# KWSYS_LIBRARY_INSTALL_DIR = The installation target directories into
# KWSYS_HEADER_INSTALL_DIR which the libraries and headers from
# kwsys should be installed by a "make install".
# The values should be specified relative to
# the installation prefix and start with a '/'.
# Example:
#
# SET(KWSYS_LIBRARY_INSTALL_DIR /lib)
# SET(KWSYS_HEADER_INSTALL_DIR /include)
#
2003-12-23 19:03:33 +03:00
# KWSYS_IOS_FORCE_OLD = Force use of old non-ANSI C++ streams even if
# new streams are available. This may be used
# by projects that cannot configure their
# streams library.
2003-06-20 02:57:11 +04:00
# Example:
#
2003-12-23 19:03:33 +03:00
# SET(KWSYS_IOS_FORCE_OLD 1)
2003-06-20 02:57:11 +04:00
#
# Once configured, kwsys should be used as follows from C or C++ code:
#
2003-06-26 21:39:35 +04:00
# #include <foosys/Directory.hxx>
2003-06-20 02:57:11 +04:00
# ...
2003-06-26 21:39:35 +04:00
# foosys::Directory directory;
2003-06-20 02:57:11 +04:00
#
#-----------------------------------------------------------------------------
# If a namespace is not specified, use "kwsys" and enable testing.
# This should be the case only when kwsys is not included inside
# another project and is being tested.
2003-05-08 22:17:26 +04:00
IF ( NOT KWSYS_NAMESPACE )
SET ( KWSYS_NAMESPACE "kwsys" )
2003-06-20 02:57:11 +04:00
SET ( KWSYS_STANDALONE 1 )
2005-04-13 21:57:24 +04:00
ENDIF ( NOT KWSYS_NAMESPACE )
IF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
2004-07-03 01:39:47 +04:00
SET ( KWSYS_ENABLE_C 1 )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Enable all components.
2003-06-30 16:48:31 +04:00
SET ( KWSYS_USE_Base64 1 )
2003-06-20 02:57:11 +04:00
SET ( KWSYS_USE_Directory 1 )
2003-06-30 16:48:31 +04:00
SET ( KWSYS_USE_Process 1 )
2003-06-20 02:57:11 +04:00
SET ( KWSYS_USE_RegularExpression 1 )
SET ( KWSYS_USE_SystemTools 1 )
2004-09-14 00:15:02 +04:00
SET ( KWSYS_USE_CommandLineArguments 1 )
2005-07-26 19:37:30 +04:00
SET ( KWSYS_USE_FundamentalType 1 )
2005-04-13 21:57:24 +04:00
ENDIF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
2004-01-19 17:30:09 +03:00
#-----------------------------------------------------------------------------
# The project name is that of the specified namespace.
PROJECT ( ${ KWSYS_NAMESPACE } )
2004-01-17 20:47:11 +03:00
2004-01-19 17:30:09 +03:00
# Enable testing if building standalone.
IF ( KWSYS_STANDALONE )
2005-04-13 21:57:24 +04:00
INCLUDE ( Dart )
2004-01-17 20:47:11 +03:00
MARK_AS_ADVANCED ( BUILD_TESTING DART_ROOT TCL_TCLSH )
IF ( BUILD_TESTING )
ENABLE_TESTING ( )
ENDIF ( BUILD_TESTING )
2004-01-19 17:30:09 +03:00
ENDIF ( KWSYS_STANDALONE )
2003-06-11 18:21:31 +04:00
2003-06-23 16:56:03 +04:00
# Do full dependency headers.
INCLUDE_REGULAR_EXPRESSION ( "^.*$" )
2003-06-11 18:21:31 +04:00
# Work-around for CMake 1.6.7 bug in custom command dependencies when
# there is no executable output path.
IF ( NOT EXECUTABLE_OUTPUT_PATH )
SET ( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}" CACHE PATH
" O u t p u t d i r e c t o r y f o r e x e c u t a b l e s . " )
ENDIF ( NOT EXECUTABLE_OUTPUT_PATH )
2003-07-10 22:46:48 +04:00
# Generated source files will need this header.
STRING ( COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
K W S Y S _ I N _ S O U R C E _ B U I L D )
IF ( NOT KWSYS_IN_SOURCE_BUILD )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsysPrivate.h
$ { P R O J E C T _ B I N A R Y _ D I R } / k w s y s P r i v a t e . h C O P Y _ O N L Y I M M E D I A T E )
ENDIF ( NOT KWSYS_IN_SOURCE_BUILD )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# We require ANSI support from the C compiler. Add any needed flags.
IF ( CMAKE_ANSI_CFLAGS )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}" )
ENDIF ( CMAKE_ANSI_CFLAGS )
2003-06-11 18:21:31 +04:00
2004-04-30 01:44:52 +04:00
#-----------------------------------------------------------------------------
# Adjust compiler flags for some platforms.
IF ( NOT CMAKE_COMPILER_IS_GNUCXX )
IF ( CMAKE_SYSTEM MATCHES "OSF1-V.*" )
STRING ( REGEX MATCH "-timplicit_local"
K W S Y S _ C X X _ F L A G S _ H A V E _ I M P L I C I T _ L O C A L " $ { C M A K E _ C X X _ F L A G S } " )
STRING ( REGEX MATCH "-no_implicit_include"
K W S Y S _ C X X _ F L A G S _ H A V E _ N O _ I M P L I C I T _ I N C L U D E " $ { C M A K E _ C X X _ F L A G S } " )
IF ( NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local" )
ENDIF ( NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL )
IF ( NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include" )
ENDIF ( NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE )
ENDIF ( CMAKE_SYSTEM MATCHES "OSF1-V.*" )
ENDIF ( NOT CMAKE_COMPILER_IS_GNUCXX )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's
2003-12-23 19:03:33 +03:00
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
INCLUDE ( ${ CMAKE_CURRENT_SOURCE_DIR } /kwsysPlatformCxxTests.cmake )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAVE_STD
" C h e c k i n g w h e t h e r S T L c l a s s e s a r e i n s t d n a m e s p a c e " D I R E C T )
IF ( KWSYS_IOS_FORCE_OLD )
2003-12-31 01:15:51 +03:00
SET ( KWSYS_IOS_USE_ANSI 0 )
2003-12-23 19:03:33 +03:00
ELSE ( KWSYS_IOS_FORCE_OLD )
2003-12-31 01:15:51 +03:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_ANSI
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r A N S I s t r e a m h e a d e r s a r e a v a i l a b l e " D I R E C T )
ENDIF ( KWSYS_IOS_FORCE_OLD )
2003-12-31 01:15:51 +03:00
IF ( KWSYS_IOS_USE_ANSI )
2003-12-23 19:03:33 +03:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_HAVE_STD
" C h e c k i n g w h e t h e r A N S I s t r e a m s a r e i n s t d n a m e s p a c e " D I R E C T )
2003-12-31 01:15:51 +03:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_SSTREAM
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r A N S I s t r i n g s t r e a m i s a v a i l a b l e " D I R E C T )
2003-12-31 01:15:51 +03:00
ELSE ( KWSYS_IOS_USE_ANSI )
2003-12-23 19:03:33 +03:00
SET ( KWSYS_IOS_HAVE_STD 0 )
2003-12-31 01:15:51 +03:00
SET ( KWSYS_IOS_USE_SSTREAM 0 )
ENDIF ( KWSYS_IOS_USE_ANSI )
IF ( KWSYS_IOS_USE_SSTREAM )
SET ( KWSYS_IOS_USE_STRSTREAM_H 0 )
SET ( KWSYS_IOS_USE_STRSTREA_H 0 )
ELSE ( KWSYS_IOS_USE_SSTREAM )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_STRSTREAM_H
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r s t r s t r e a m . h i s a v a i l a b l e " D I R E C T )
2003-12-31 01:15:51 +03:00
IF ( KWSYS_IOS_USE_STRSTREAM_H )
SET ( KWSYS_IOS_USE_STRSTREA_H 0 )
ELSE ( KWSYS_IOS_USE_STRSTREAM_H )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_STRSTREA_H
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r s t r s t r e a . h i s a v a i l a b l e " D I R E C T )
2003-12-31 01:15:51 +03:00
ENDIF ( KWSYS_IOS_USE_STRSTREAM_H )
ENDIF ( KWSYS_IOS_USE_SSTREAM )
2003-05-12 21:43:03 +04:00
2005-04-16 00:00:44 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_CSTDDEF
" C h e c k i n g w h e t h e r h e a d e r c s t d d e f i s a v a i l a b l e " D I R E C T )
2005-03-31 00:27:16 +04:00
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES
- D K W S Y S _ S T L _ H A V E _ S T D = $ { K W S Y S _ S T L _ H A V E _ S T D } )
2005-03-29 19:10:25 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_STRING_HAVE_NEQ_CHAR
" C h e c k i n g w h e t h e r s t l s t r i n g h a s o p e r a t o r ! = f o r c h a r * " D I R E C T )
2005-04-15 17:54:03 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ITERATOR_TRAITS
" C h e c k i n g w h e t h e r s t l h a s i t e r a t o r _ t r a i t s " D I R E C T )
IF ( KWSYS_STL_HAS_ITERATOR_TRAITS )
SET ( KWSYS_STL_HAS_ITERATOR_CATEGORY 0 )
SET ( KWSYS_STL_HAS___ITERATOR_CATEGORY 0 )
ELSE ( KWSYS_STL_HAS_ITERATOR_TRAITS )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ITERATOR_CATEGORY
" C h e c k i n g w h e t h e r s t l h a s o l d i t e r a t o r _ c a t e g o r y " D I R E C T )
IF ( KWSYS_STL_HAS_ITERATOR_CATEGORY )
SET ( KWSYS_STL_HAS___ITERATOR_CATEGORY 0 )
ELSE ( KWSYS_STL_HAS_ITERATOR_CATEGORY )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS___ITERATOR_CATEGORY
" C h e c k i n g w h e t h e r s t l h a s i n t e r n a l _ _ i t e r a t o r _ c a t e g o r y " D I R E C T )
ENDIF ( KWSYS_STL_HAS_ITERATOR_CATEGORY )
ENDIF ( KWSYS_STL_HAS_ITERATOR_TRAITS )
2005-04-21 21:47:43 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
" C h e c k i n g w h e t h e r s t l h a s s t a n d a r d t e m p l a t e a l l o c a t o r " D I R E C T )
IF ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE )
SET ( KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE 0 )
2005-04-15 17:54:03 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_REBIND
" C h e c k i n g f o r r e b i n d m e m b e r o f s t l a l l o c a t o r " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
" C h e c k i n g f o r n o n - s t a n d a r d a r g u m e n t t o s t l a l l o c a t o r < > : : m a x _ s i z e " D I R E C T )
2005-04-21 21:47:43 +04:00
ELSE ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
" C h e c k i n g w h e t h e r s t l h a s o l d n o n - t e m p l a t e a l l o c a t o r " D I R E C T )
SET ( KWSYS_STL_HAS_ALLOCATOR_REBIND 0 )
SET ( KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT 0 )
ENDIF ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_OBJECTS
" C h e c k i n g w h e t h e r s t l c o n t a i n e r s s u p p o r t a l l o c a t o r o b j e c t s . " D I R E C T )
2005-03-29 17:20:08 +04:00
IF ( KWSYS_IOS_USE_ANSI )
# ANSI streams always have string operators.
SET ( KWSYS_STL_STRING_HAVE_OSTREAM 1 )
SET ( KWSYS_STL_STRING_HAVE_ISTREAM 1 )
ELSE ( KWSYS_IOS_USE_ANSI )
# There may not be string operators for old streams.
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_STRING_HAVE_OSTREAM
" C h e c k i n g w h e t h e r s t l s t r i n g h a s o s t r e a m o p e r a t o r < < " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_STRING_HAVE_ISTREAM
" C h e c k i n g w h e t h e r s t l s t r i n g h a s i s t r e a m o p e r a t o r > > " D I R E C T )
ENDIF ( KWSYS_IOS_USE_ANSI )
2005-03-31 00:27:16 +04:00
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
2005-03-29 17:20:08 +04:00
2005-04-13 16:08:54 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
" C h e c k i n g w h e t h e r \ " < > \ " i s n e e d e d f o r t e m p l a t e f r i e n d s " I N V E R T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_MEMBER_TEMPLATES
" C h e c k i n g f o r m e m b e r t e m p l a t e s u p p o r t " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_FULL_SPECIALIZATION
" C h e c k i n g f o r s t a n d a r d t e m p l a t e s p e c i a l i z a t i o n s y n t a x " D I R E C T )
2005-04-15 16:59:30 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
" C h e c k i n g w h e t h e r a r g u m e n t d e p e n d e n t l o o k u p i s s u p p o r t e d " D I R E C T )
2005-04-13 16:08:54 +04:00
2005-02-17 18:49:16 +03:00
IF ( UNIX )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STAT_HAS_ST_MTIM
" C h e c k i n g w h e t h e r s t r u c t s t a t h a s s t _ m t i m m e m b e r " D I R E C T )
ENDIF ( UNIX )
2005-07-26 19:37:30 +04:00
IF ( KWSYS_USE_FundamentalType )
# Determine type sizes.
INCLUDE ( CheckTypeSize )
CHECK_TYPE_SIZE ( "char" KWSYS_SIZEOF_CHAR )
CHECK_TYPE_SIZE ( "short" KWSYS_SIZEOF_SHORT )
CHECK_TYPE_SIZE ( "int" KWSYS_SIZEOF_INT )
CHECK_TYPE_SIZE ( "long" KWSYS_SIZEOF_LONG )
CHECK_TYPE_SIZE ( "long long" KWSYS_SIZEOF_LONG_LONG )
CHECK_TYPE_SIZE ( "__int64" KWSYS_SIZEOF___INT64 )
IF ( NOT KWSYS_SIZEOF_LONG_LONG )
SET ( KWSYS_SIZEOF_LONG_LONG 0 )
ENDIF ( NOT KWSYS_SIZEOF_LONG_LONG )
IF ( NOT KWSYS_SIZEOF___INT64 )
SET ( KWSYS_SIZEOF___INT64 0 )
ENDIF ( NOT KWSYS_SIZEOF___INT64 )
# Check uniqueness of types.
IF ( KWSYS_SIZEOF___INT64 )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_SAME_LONG_AND___INT64
" C h e c k i n g w h e t h e r l o n g a n d _ _ i n t 6 4 a r e t h e s a m e t y p e " D I R E C T )
IF ( KWSYS_SIZEOF_LONG_LONG )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_SAME_LONG_LONG_AND___INT64
" C h e c k i n g w h e t h e r l o n g l o n g a n d _ _ i n t 6 4 a r e t h e s a m e t y p e " D I R E C T )
ENDIF ( KWSYS_SIZEOF_LONG_LONG )
ENDIF ( KWSYS_SIZEOF___INT64 )
# Enable the "long long" type if it is available. It is standard in
# C99 and C++03 but not in earlier standards.
IF ( KWSYS_SIZEOF_LONG_LONG )
SET ( KWSYS_USE_LONG_LONG 1 )
ELSE ( KWSYS_SIZEOF_LONG_LONG )
SET ( KWSYS_USE_LONG_LONG 0 )
ENDIF ( KWSYS_SIZEOF_LONG_LONG )
# Enable the "__int64" type if it is available and unique. It is not
# standard.
SET ( KWSYS_USE___INT64 0 )
IF ( KWSYS_SIZEOF___INT64 )
IF ( NOT KWSYS_CXX_SAME_LONG_AND___INT64 )
IF ( NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64 )
SET ( KWSYS_USE___INT64 1 )
ENDIF ( NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64 )
ENDIF ( NOT KWSYS_CXX_SAME_LONG_AND___INT64 )
ENDIF ( KWSYS_SIZEOF___INT64 )
IF ( KWSYS_USE___INT64 )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
" C h e c k i n g w h e t h e r u n s i g n e d _ _ i n t 6 4 c a n c o n v e r t t o d o u b l e " D I R E C T )
ELSE ( KWSYS_USE___INT64 )
SET ( KWSYS_CAN_CONVERT_UI64_TO_DOUBLE 1 )
ENDIF ( KWSYS_USE___INT64 )
# Check signedness of "char" type.
IF ( "KWSYS_CHAR_IS_SIGNED" MATCHES "^KWSYS_CHAR_IS_SIGNED$" )
MESSAGE ( STATUS "Checking signedness of char" )
TRY_RUN ( KWSYS_CHAR_IS_SIGNED KWSYS_CHAR_IS_SIGNED_COMPILED
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / k w s y s P l a t f o r m C x x T e s t s . c x x
C O M P I L E _ D E F I N I T I O N S - D T E S T _ K W S Y S _ C H A R _ I S _ S I G N E D )
IF ( KWSYS_CHAR_IS_SIGNED_COMPILED )
IF ( KWSYS_CHAR_IS_SIGNED )
MESSAGE ( STATUS "Checking signedness of char -- signed" )
SET ( KWSYS_CHAR_IS_SIGNED 1 CACHE INTERNAL "Whether char is signed." )
ELSE ( KWSYS_CHAR_IS_SIGNED )
MESSAGE ( STATUS "Checking signedness of char -- unsigned" )
SET ( KWSYS_CHAR_IS_SIGNED 0 CACHE INTERNAL "Whether char is signed." )
ENDIF ( KWSYS_CHAR_IS_SIGNED )
ELSE ( KWSYS_CHAR_IS_SIGNED_COMPILED )
MESSAGE ( FATAL_ERROR "Checking signedness of char -- failed" )
ENDIF ( KWSYS_CHAR_IS_SIGNED_COMPILED )
ENDIF ( "KWSYS_CHAR_IS_SIGNED" MATCHES "^KWSYS_CHAR_IS_SIGNED$" )
ENDIF ( KWSYS_USE_FundamentalType )
2003-06-20 02:57:11 +04:00
IF ( KWSYS_NAMESPACE MATCHES "^kwsys$" )
SET ( KWSYS_NAME_IS_KWSYS 1 )
ELSE ( KWSYS_NAMESPACE MATCHES "^kwsys$" )
SET ( KWSYS_NAME_IS_KWSYS 0 )
ENDIF ( KWSYS_NAMESPACE MATCHES "^kwsys$" )
2003-06-30 18:30:38 +04:00
# Choose default shared/static build if not specified.
IF ( KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$" )
SET ( KWSYS_BUILD_SHARED ${ BUILD_SHARED_LIBS } )
ENDIF ( KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$" )
IF ( KWSYS_BUILD_SHARED )
SET ( KWSYS_BUILD_SHARED 1 )
SET ( KWSYS_LIBRARY_TYPE SHARED )
ELSE ( KWSYS_BUILD_SHARED )
SET ( KWSYS_BUILD_SHARED 0 )
SET ( KWSYS_LIBRARY_TYPE STATIC )
ENDIF ( KWSYS_BUILD_SHARED )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Choose a directory for the generated headers.
2003-06-20 22:10:28 +04:00
IF ( NOT KWSYS_HEADER_ROOT )
SET ( KWSYS_HEADER_ROOT "${PROJECT_BINARY_DIR}" )
ENDIF ( NOT KWSYS_HEADER_ROOT )
SET ( KWSYS_HEADER_DIR "${KWSYS_HEADER_ROOT}/${KWSYS_NAMESPACE}" )
2004-03-15 22:54:26 +03:00
INCLUDE_DIRECTORIES ( ${ KWSYS_HEADER_ROOT } )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Create STL header wrappers to block warnings in the STL headers and
# give standard names by which they may be included.
2005-03-29 17:20:08 +04:00
SET ( KWSYS_STL_HEADER_EXTRA_string 1 )
2003-06-20 02:57:11 +04:00
FOREACH ( header algorithm deque iterator list map numeric queue set stack string
2005-04-13 16:08:54 +04:00
u t i l i t y v e c t o r m e m o r y f u n c t i o n a l )
2003-06-20 02:57:11 +04:00
# Configure the header wrapper.
SET ( KWSYS_STL_HEADER "${header}" )
2005-03-29 17:20:08 +04:00
IF ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
SET ( KWSYS_STL_HEADER_EXTRA
" #define ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n# include <${KWSYS_NAMESPACE}/stl/${header}.hxx>\n#undef ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n")
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_stl_ ${ header } .hxx.in
$ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r } . h x x
@ O N L Y I M M E D I A T E )
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE } /stl
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r } . h x x )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ELSE ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
SET ( KWSYS_STL_HEADER_EXTRA "" )
ENDIF ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_stl.hxx.in
2003-12-23 19:03:33 +03:00
$ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r }
2003-06-20 02:57:11 +04:00
@ O N L Y I M M E D I A T E )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Create an install target for the header wrapper.
IF ( KWSYS_HEADER_INSTALL_DIR )
2003-12-23 19:03:33 +03:00
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE } /stl
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r } )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ENDFOREACH ( header )
2005-04-16 00:00:44 +04:00
# Provide cstddef header.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_cstddef.hxx.in
$ { K W S Y S _ H E A D E R _ D I R } / c s t d d e f
@ O N L Y I M M E D I A T E )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Create streams header wrappers to give standard names by which they
# may be included.
FOREACH ( header iostream fstream sstream iosfwd )
# Configure the header wrapper.
2003-12-23 19:03:33 +03:00
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_ios_ ${ header } .h.in
$ { K W S Y S _ H E A D E R _ D I R } / i o s / $ { h e a d e r }
2003-06-20 02:57:11 +04:00
@ O N L Y I M M E D I A T E )
# Create an install target for the header wrapper.
IF ( KWSYS_HEADER_INSTALL_DIR )
2003-12-23 19:03:33 +03:00
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE } /ios
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / i o s / $ { h e a d e r } )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ENDFOREACH ( header )
#-----------------------------------------------------------------------------
# Build a list of classes and headers we need to implement the
# selected components. Initialize with required components.
SET ( KWSYS_CLASSES )
2005-03-25 16:41:57 +03:00
SET ( KWSYS_H_FILES Configure SharedForward )
2005-04-13 16:08:54 +04:00
SET ( KWSYS_HXX_FILES Configure hashtable hash_fun hash_map hash_set )
2003-06-20 02:57:11 +04:00
2003-12-16 23:37:24 +03:00
# Enforce component dependencies.
IF ( KWSYS_USE_SystemTools )
SET ( KWSYS_USE_Directory 1 )
ENDIF ( KWSYS_USE_SystemTools )
2003-06-20 02:57:11 +04:00
# Add selected C++ classes.
2004-09-14 00:15:02 +04:00
FOREACH ( c Directory RegularExpression SystemTools CommandLineArguments )
2003-06-20 02:57:11 +04:00
IF ( KWSYS_USE_ ${ c } )
SET ( KWSYS_CLASSES ${ KWSYS_CLASSES } ${ c } )
ENDIF ( KWSYS_USE_ ${ c } )
ENDFOREACH ( c )
# Add selected C components.
2005-07-26 19:37:30 +04:00
FOREACH ( c Process Base64 FundamentalType )
2003-06-30 16:48:31 +04:00
IF ( KWSYS_USE_ ${ c } )
SET ( KWSYS_H_FILES ${ KWSYS_H_FILES } ${ c } )
ENDIF ( KWSYS_USE_ ${ c } )
ENDFOREACH ( c )
2003-06-11 00:56:13 +04:00
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Build a list of sources for the library based on components that are
# included.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS )
SET ( KWSYS_CXX_SRCS )
2003-06-20 02:57:11 +04:00
# Add the proper sources for this platform's Process implementation.
IF ( KWSYS_USE_Process )
2005-04-16 00:10:26 +04:00
IF ( NOT UNIX )
2003-06-20 02:57:11 +04:00
# Use the Windows implementation. We need the encoded forwarding executable.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessWin32.c
2003-07-10 22:46:48 +04:00
$ { P R O J E C T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c )
SET_SOURCE_FILES_PROPERTIES (
$ { P R O J E C T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
P R O P E R T I E S G E N E R A T E D 1 )
2005-04-16 00:10:26 +04:00
ELSE ( NOT UNIX )
2003-06-20 02:57:11 +04:00
# Use the UNIX implementation.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessUNIX.c )
2005-04-16 00:10:26 +04:00
ENDIF ( NOT UNIX )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_USE_Process )
2003-06-30 16:48:31 +04:00
# Add sources for Base64 encoding.
2003-06-30 05:42:48 +04:00
IF ( KWSYS_USE_Base64 )
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } Base64.c )
2003-06-30 05:42:48 +04:00
ENDIF ( KWSYS_USE_Base64 )
2003-06-20 02:57:11 +04:00
# Configure headers of C++ classes and construct the list of sources.
FOREACH ( c ${ KWSYS_CLASSES } )
# Add this source to the list of source files for the library.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_CXX_SRCS ${ KWSYS_CXX_SRCS } ${ c } .cxx )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Configure the header for this class.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ c } .hxx.in ${ KWSYS_HEADER_DIR } / ${ c } .hxx
2003-04-08 21:10:44 +04:00
@ O N L Y I M M E D I A T E )
2003-06-20 02:57:11 +04:00
# Create an install target for the header.
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE }
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / $ { c } . h x x )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
2003-04-08 21:10:44 +04:00
ENDFOREACH ( c )
2003-06-20 02:57:11 +04:00
# Configure C headers.
FOREACH ( h ${ KWSYS_H_FILES } )
# Configure the header into the given directory.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ h } .h.in ${ KWSYS_HEADER_DIR } / ${ h } .h
2003-06-10 23:46:31 +04:00
@ O N L Y I M M E D I A T E )
2003-06-20 02:57:11 +04:00
# Create an install target for the header.
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE }
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / $ { h } . h )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
2003-06-10 23:46:31 +04:00
ENDFOREACH ( h )
2003-06-20 02:57:11 +04:00
# Configure other C++ headers.
FOREACH ( h ${ KWSYS_HXX_FILES } )
# Configure the header into the given directory.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ h } .hxx.in ${ KWSYS_HEADER_DIR } / ${ h } .hxx
2003-04-08 21:10:44 +04:00
@ O N L Y I M M E D I A T E )
2003-06-20 02:57:11 +04:00
# Create an install target for the header.
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE }
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / $ { h } . h x x )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ENDFOREACH ( h )
2003-04-08 21:10:44 +04:00
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Add the library with the configured name and list of sources.
2004-07-03 01:39:47 +04:00
IF ( KWSYS_C_SRCS OR KWSYS_CXX_SRCS )
ADD_LIBRARY ( ${ KWSYS_NAMESPACE } ${ KWSYS_LIBRARY_TYPE }
$ { K W S Y S _ C _ S R C S } $ { K W S Y S _ C X X _ S R C S } )
2004-06-04 22:59:05 +04:00
2005-08-05 01:12:22 +04:00
# Apply user-defined target properties to the library.
IF ( KWSYS_PROPERTIES_CXX )
SET_TARGET_PROPERTIES ( ${ KWSYS_NAMESPACE } PROPERTIES
$ { K W S Y S _ P R O P E R T I E S _ C X X }
)
ENDIF ( KWSYS_PROPERTIES_CXX )
2004-06-04 22:59:05 +04:00
# Create an install target for the library.
IF ( KWSYS_LIBRARY_INSTALL_DIR )
INSTALL_TARGETS ( ${ KWSYS_LIBRARY_INSTALL_DIR } ${ KWSYS_NAMESPACE } )
ENDIF ( KWSYS_LIBRARY_INSTALL_DIR )
2004-07-03 01:39:47 +04:00
ENDIF ( KWSYS_C_SRCS OR KWSYS_CXX_SRCS )
# Add a C-only library if requested.
IF ( KWSYS_ENABLE_C AND KWSYS_C_SRCS )
ADD_LIBRARY ( ${ KWSYS_NAMESPACE } _c ${ KWSYS_LIBRARY_TYPE } ${ KWSYS_C_SRCS } )
2005-08-05 01:12:22 +04:00
# Apply user-defined target properties to the library.
IF ( KWSYS_PROPERTIES_C )
SET_TARGET_PROPERTIES ( ${ KWSYS_NAMESPACE } PROPERTIES
$ { K W S Y S _ P R O P E R T I E S _ C }
)
ENDIF ( KWSYS_PROPERTIES_C )
2004-07-03 01:39:47 +04:00
# Create an install target for the library.
IF ( KWSYS_LIBRARY_INSTALL_DIR )
INSTALL_TARGETS ( ${ KWSYS_LIBRARY_INSTALL_DIR } ${ KWSYS_NAMESPACE } _c )
ENDIF ( KWSYS_LIBRARY_INSTALL_DIR )
ENDIF ( KWSYS_ENABLE_C AND KWSYS_C_SRCS )
2003-04-08 21:10:44 +04:00
2003-06-20 02:57:11 +04:00
# For building kwsys itself, we use a macro defined on the command
2003-07-10 22:32:30 +04:00
# line to configure the namespace in the C and C++ source files.
2003-06-20 02:57:11 +04:00
ADD_DEFINITIONS ( "-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}" )
2003-05-08 22:17:26 +04:00
2003-05-08 22:46:23 +04:00
#-----------------------------------------------------------------------------
2003-06-20 02:57:11 +04:00
# Process execution on windows needs to build a forwarding executable
# that works around a Win9x bug. We encode the executable into a C
# file and build it into the library. Win9x platforms reproduce the
# executable into a temporary directory when it is needed.
IF ( KWSYS_USE_Process )
2005-04-16 00:10:26 +04:00
IF ( NOT UNIX )
2003-06-20 02:57:11 +04:00
# Build the forwarding executable itself and a program that will
# encode it into a C file.
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } ProcessFwd9x ProcessFwd9x.c )
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } EncodeExecutable EncodeExecutable.c )
2003-05-08 22:46:23 +04:00
2003-06-20 02:57:11 +04:00
# Construct the location of the executable to be encoded.
SET ( BIN_DIR ${ CMAKE_CURRENT_BINARY_DIR } )
IF ( EXECUTABLE_OUTPUT_PATH )
SET ( BIN_DIR ${ EXECUTABLE_OUTPUT_PATH } )
ENDIF ( EXECUTABLE_OUTPUT_PATH )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
SET ( CFG_INTDIR "/${CMAKE_CFG_INTDIR}" )
IF ( CMAKE_BUILD_TOOL MATCHES "make" )
SET ( CFG_INTDIR "" )
ENDIF ( CMAKE_BUILD_TOOL MATCHES "make" )
2003-05-12 21:15:49 +04:00
2003-06-20 02:57:11 +04:00
# Take advantage of a better custom command syntax if possible.
SET ( CMD ${ BIN_DIR } ${ CFG_INTDIR } / ${ KWSYS_NAMESPACE } EncodeExecutable.exe )
SET ( FWD ${ BIN_DIR } ${ CFG_INTDIR } / ${ KWSYS_NAMESPACE } ProcessFwd9x.exe )
IF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6 )
ADD_CUSTOM_COMMAND (
O U T P U T $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
C O M M A N D $ { C M D }
A R G S $ { F W D } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
2004-05-06 23:34:04 +04:00
$ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x
2003-06-20 02:57:11 +04:00
D E P E N D S $ { C M D } $ { F W D } )
ELSE ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6 )
ADD_CUSTOM_COMMAND (
T A R G E T $ { K W S Y S _ N A M E S P A C E }
S O U R C E $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / P r o c e s s F w d 9 x . c
C O M M A N D $ { C M D }
A R G S $ { F W D } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
2004-05-06 23:34:04 +04:00
$ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x
2003-06-20 02:57:11 +04:00
O U T P U T S $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
D E P E N D S $ { C M D } $ { F W D } )
ENDIF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6 )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Make sure build occurs in proper order.
ADD_DEPENDENCIES ( ${ KWSYS_NAMESPACE } ${ KWSYS_NAMESPACE } ProcessFwd9x
$ { K W S Y S _ N A M E S P A C E } E n c o d e E x e c u t a b l e )
2005-04-16 00:10:26 +04:00
ENDIF ( NOT UNIX )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_USE_Process )
#-----------------------------------------------------------------------------
# Setup testing if not being built as part of another project.
2005-04-13 21:57:24 +04:00
IF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
# C++ tests
FOREACH ( test
t e s t S y s t e m T o o l s
t e s t I O S
2005-07-20 20:02:45 +04:00
t e s t H a s h S T L
2005-04-13 21:57:24 +04:00
t e s t C o m m a n d L i n e A r g u m e n t s
)
ADD_EXECUTABLE ( ${ test } ${ test } .cxx )
TARGET_LINK_LIBRARIES ( ${ test } ${ KWSYS_NAMESPACE } )
ENDFOREACH ( test )
# C tests
FOREACH ( test
t e s t P r o c e s s
)
ADD_EXECUTABLE ( ${ test } ${ test } .c )
TARGET_LINK_LIBRARIES ( ${ test } ${ KWSYS_NAMESPACE } _c )
ENDFOREACH ( test )
2004-01-17 20:47:11 +03:00
2004-10-18 06:46:48 +04:00
SET ( EXEC_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
IF ( EXECUTABLE_OUTPUT_PATH )
SET ( EXEC_DIR "${EXECUTABLE_OUTPUT_PATH}" )
ENDIF ( EXECUTABLE_OUTPUT_PATH )
2004-01-17 20:47:11 +03:00
IF ( BUILD_TESTING )
2005-06-07 17:57:05 +04:00
IF ( CTEST_TEST_KWSYS )
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/ExtraTest.cmake.in"
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / E x t r a T e s t . c m a k e " )
SET_DIRECTORY_PROPERTIES ( PROPERTIES TEST_INCLUDE_FILE "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake" )
ENDIF ( CTEST_TEST_KWSYS )
2005-04-13 21:57:24 +04:00
ADD_TEST ( kwsys-testSystemTools ${ EXEC_DIR } /testSystemTools )
ADD_TEST ( kwsys-testProcess-1 ${ EXEC_DIR } /testProcess 1 )
ADD_TEST ( kwsys-testProcess-2 ${ EXEC_DIR } /testProcess 2 )
ADD_TEST ( kwsys-testProcess-3 ${ EXEC_DIR } /testProcess 3 )
ADD_TEST ( kwsys-testProcess-4 ${ EXEC_DIR } /testProcess 4 )
ADD_TEST ( kwsys-testProcess-5 ${ EXEC_DIR } /testProcess 5 )
ADD_TEST ( kwsys-testProcess-6 ${ EXEC_DIR } /testProcess 6 )
2005-06-17 22:13:32 +04:00
ADD_TEST ( kwsys-testProcess-7 ${ EXEC_DIR } /testProcess 7 )
2005-07-20 20:02:45 +04:00
ADD_TEST ( kwsys-testHashSTL ${ EXEC_DIR } /testHashSTL )
2004-01-17 20:47:11 +03:00
ENDIF ( BUILD_TESTING )
2005-04-13 21:57:24 +04:00
ENDIF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )