#=============================================================================
# KWSys - Kitware System Library
# Copyright 2000-2011 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.
#=============================================================================
# The Kitware System Library is intended to be included in other
# projects. It is completely configurable in that the library's
# namespace can be configured and the components that are included can
# be selected invididually.
# Typical usage is to import the kwsys directory tree into a
# 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:
#
# SET(KWSYS_NAMESPACE foosys)
# SET(KWSYS_USE_Directory 1) # Enable Directory class.
# SUBDIRS(kwsys)
#
# Optional settings are as follows:
#
# 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.
#
# Example:
#
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
#
# 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.
# Example:
#
# SET(KWSYS_IOS_FORCE_OLD 1)
#
#
# Optional settings to setup install rules are as follows:
#
# KWSYS_INSTALL_BIN_DIR = The installation target directories into
# KWSYS_INSTALL_LIB_DIR which the libraries and headers from
# KWSYS_INSTALL_INCLUDE_DIR kwsys should be installed by a "make install".
# The values should be specified relative to
# the installation prefix and NOT start with '/'.
# KWSYS_INSTALL_DOC_DIR = The installation target directory for documentation
# such as copyright information.
#
# KWSYS_INSTALL_COMPONENT_NAME_RUNTIME = Name of runtime and development
# KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT installation components.
# If not given the install rules
# will not be in any component.
#
# KWSYS_INSTALL_EXPORT_NAME = The EXPORT option value for install(TARGETS) calls.
#
# Example:
#
# SET(KWSYS_INSTALL_BIN_DIR bin)
# SET(KWSYS_INSTALL_LIB_DIR lib)
# SET(KWSYS_INSTALL_INCLUDE_DIR include)
# SET(KWSYS_INSTALL_COMPONENT_NAME_RUNTIME Runtime)
# SET(KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT Development)
# Once configured, kwsys should be used as follows from C or C++ code:
#
# #include <foosys/Directory.hxx>
# ...
# foosys::Directory directory;
#
# NOTE: This library is intended for internal use by Kitware-driven
# projects. In order to keep it simple no attempt will be made to
# maintain backward compatibility when changes are made to KWSys.
# When an incompatible change is made Kitware's projects that use
# KWSys will be fixed, but no notification will necessarily be sent to
# any outside mailing list and no documentation of the change will be
# written.
CMAKE_MINIMUM_REQUIRED ( VERSION 2.6.3 FATAL_ERROR )
#-----------------------------------------------------------------------------
# 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.
IF ( NOT KWSYS_NAMESPACE )
SET ( KWSYS_NAMESPACE "kwsys" )
SET ( KWSYS_STANDALONE 1 )
ENDIF ( NOT KWSYS_NAMESPACE )
#-----------------------------------------------------------------------------
# The project name is that of the specified namespace.
PROJECT ( ${ KWSYS_NAMESPACE } )
# Tell CMake how to follow dependencies of sources in this directory.
SET_PROPERTY ( DIRECTORY
P R O P E R T Y I M P L I C I T _ D E P E N D S _ I N C L U D E _ T R A N S F O R M
" KWSYS_HEADER ( % ) = < $ { K W S Y S _ N A M E S P A C E } / % > "
)
# Select library components.
IF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
SET ( KWSYS_ENABLE_C 1 )
# Enable all components.
SET ( KWSYS_USE_Base64 1 )
SET ( KWSYS_USE_Directory 1 )
SET ( KWSYS_USE_DynamicLoader 1 )
SET ( KWSYS_USE_Glob 1 )
SET ( KWSYS_USE_MD5 1 )
SET ( KWSYS_USE_Process 1 )
SET ( KWSYS_USE_RegularExpression 1 )
SET ( KWSYS_USE_System 1 )
SET ( KWSYS_USE_SystemTools 1 )
SET ( KWSYS_USE_CommandLineArguments 1 )
SET ( KWSYS_USE_FundamentalType 1 )
SET ( KWSYS_USE_Terminal 1 )
SET ( KWSYS_USE_IOStream 1 )
SET ( KWSYS_USE_String 1 )
SET ( KWSYS_USE_SystemInformation 1 )
SET ( KWSYS_USE_CPU 1 )
ENDIF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
# Enforce component dependencies.
IF ( KWSYS_USE_SystemTools )
SET ( KWSYS_USE_Directory 1 )
ENDIF ( KWSYS_USE_SystemTools )
IF ( KWSYS_USE_Glob )
SET ( KWSYS_USE_Directory 1 )
SET ( KWSYS_USE_SystemTools 1 )
SET ( KWSYS_USE_RegularExpression 1 )
ENDIF ( KWSYS_USE_Glob )
IF ( KWSYS_USE_Process )
SET ( KWSYS_USE_System 1 )
ENDIF ( KWSYS_USE_Process )
IF ( KWSYS_USE_SystemInformation )
SET ( KWSYS_USE_Process 1 )
ENDIF ( KWSYS_USE_SystemInformation )
# Setup the large file support default.
IF ( KWSYS_LFS_DISABLE )
SET ( KWSYS_LFS_REQUESTED 0 )
ELSE ( KWSYS_LFS_DISABLE )
SET ( KWSYS_LFS_REQUESTED 1 )
ENDIF ( KWSYS_LFS_DISABLE )
# Enable testing if building standalone.
IF ( KWSYS_STANDALONE )
INCLUDE ( Dart )
MARK_AS_ADVANCED ( BUILD_TESTING DART_ROOT TCL_TCLSH )
IF ( BUILD_TESTING )
ENABLE_TESTING ( )
ENDIF ( BUILD_TESTING )
ENDIF ( KWSYS_STANDALONE )
# Include helper macros.
INCLUDE ( ${ CMAKE_CURRENT_SOURCE_DIR } /kwsysPlatformTests.cmake )
INCLUDE ( CheckTypeSize )
# Do full dependency headers.
INCLUDE_REGULAR_EXPRESSION ( "^.*$" )
# Use new KWSYS_INSTALL_*_DIR variable names to control installation.
# Take defaults from the old names. Note that there was no old name
# for the bin dir, so we take the old lib dir name so DLLs will be
# installed in a compatible way for old code.
IF ( NOT KWSYS_INSTALL_INCLUDE_DIR )
STRING ( REGEX REPLACE "^/" "" KWSYS_INSTALL_INCLUDE_DIR
" $ { K W S Y S _ H E A D E R _ I N S T A L L _ D I R } " )
ENDIF ( NOT KWSYS_INSTALL_INCLUDE_DIR )
IF ( NOT KWSYS_INSTALL_LIB_DIR )
STRING ( REGEX REPLACE "^/" "" KWSYS_INSTALL_LIB_DIR
" $ { K W S Y S _ L I B R A R Y _ I N S T A L L _ D I R } " )
ENDIF ( NOT KWSYS_INSTALL_LIB_DIR )
IF ( NOT KWSYS_INSTALL_BIN_DIR )
STRING ( REGEX REPLACE "^/" "" KWSYS_INSTALL_BIN_DIR
" $ { K W S Y S _ L I B R A R Y _ I N S T A L L _ D I R } " )
ENDIF ( NOT KWSYS_INSTALL_BIN_DIR )
# Setup header install rules.
SET ( KWSYS_INSTALL_INCLUDE_OPTIONS )
IF ( KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT )
SET ( KWSYS_INSTALL_INCLUDE_OPTIONS ${ KWSYS_INSTALL_INCLUDE_OPTIONS }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ D E V E L O P M E N T }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT )
# Setup library install rules.
SET ( KWSYS_INSTALL_LIBRARY_RULE )
IF ( KWSYS_INSTALL_LIB_DIR )
IF ( KWSYS_INSTALL_EXPORT_NAME )
LIST ( APPEND KWSYS_INSTALL_LIBRARY_RULE EXPORT ${ KWSYS_INSTALL_EXPORT_NAME } )
ENDIF ( )
# Install the shared library to the lib directory.
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
L I B R A R Y D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ L I B _ D I R }
)
# Assign the shared library to the runtime component.
IF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ R U N T I M E }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
# Install the archive to the lib directory.
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
A R C H I V E D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ L I B _ D I R }
)
# Assign the archive to the development component.
IF ( KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT )
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ D E V E L O P M E N T }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT )
ENDIF ( KWSYS_INSTALL_LIB_DIR )
IF ( KWSYS_INSTALL_BIN_DIR )
# Install the runtime library to the bin directory.
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
R U N T I M E D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ B I N _ D I R }
)
# Assign the runtime library to the runtime component.
IF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ R U N T I M E }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
ENDIF ( KWSYS_INSTALL_BIN_DIR )
# Do not support old KWSYS_*a_INSTALL_DIR variable names.
SET ( KWSYS_HEADER_INSTALL_DIR )
SET ( KWSYS_LIBRARY_INSTALL_DIR )
# 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 )
# Select plugin module file name convention.
IF ( NOT KWSYS_DynamicLoader_PREFIX )
SET ( KWSYS_DynamicLoader_PREFIX ${ CMAKE_SHARED_MODULE_PREFIX } )
ENDIF ( )
IF ( NOT KWSYS_DynamicLoader_SUFFIX )
SET ( KWSYS_DynamicLoader_SUFFIX ${ CMAKE_SHARED_MODULE_SUFFIX } )
ENDIF ( )
#-----------------------------------------------------------------------------
# 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 )
#-----------------------------------------------------------------------------
# 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.*" )
IF ( CMAKE_SYSTEM MATCHES "HP-UX" )
SET ( KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p" )
ENDIF ( CMAKE_SYSTEM MATCHES "HP-UX" )
ENDIF ( NOT CMAKE_COMPILER_IS_GNUCXX )
#-----------------------------------------------------------------------------
# Configure Large File Support.
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_CSTDIO
" 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 i o i s a v a i l a b l e " D I R E C T )
SET ( KWSYS_LFS_AVAILABLE 0 )
IF ( KWSYS_LFS_REQUESTED )
# Large File Support is requested.
SET ( KWSYS_LFS_REQUESTED 1 )
# Check for large file support.
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES
- D K W S Y S _ C X X _ H A S _ C S T D I O = $ { K W S Y S _ C X X _ H A S _ C S T D I O } )
KWSYS_PLATFORM_CXX_TEST_RUN ( KWSYS_LFS_WORKS
" C h e c k i n g f o r L a r g e F i l e S u p p o r t " D I R E C T )
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
IF ( KWSYS_LFS_WORKS )
SET ( KWSYS_LFS_AVAILABLE 1 )
ENDIF ( KWSYS_LFS_WORKS )
ELSE ( KWSYS_LFS_REQUESTED )
# Large File Support is not requested.
SET ( KWSYS_LFS_REQUESTED 0 )
ENDIF ( KWSYS_LFS_REQUESTED )
#-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
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 )
SET ( KWSYS_IOS_USE_ANSI 0 )
ELSE ( KWSYS_IOS_FORCE_OLD )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_ANSI
" 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 )
IF ( KWSYS_IOS_USE_ANSI )
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 )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_SSTREAM
" 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 )
ELSE ( KWSYS_IOS_USE_ANSI )
SET ( KWSYS_IOS_HAVE_STD 0 )
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
" 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 )
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
" 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 )
ENDIF ( KWSYS_IOS_USE_STRSTREAM_H )
ENDIF ( KWSYS_IOS_USE_SSTREAM )
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 )
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 } )
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 )
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 )
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 )
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 )
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 )
IF ( KWSYS_IOS_USE_ANSI AND NOT WATCOM )
# 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 AND NOT WATCOM )
# 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 AND NOT WATCOM )
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES
- D K W S Y S _ I O S _ U S E _ A N S I = $ { K W S Y S _ I O S _ U S E _ A N S I }
- D K W S Y S _ I O S _ H A V E _ S T D = $ { K W S Y S _ I O S _ H A V E _ S T D } )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_HAVE_BINARY
" C h e c k i n g w h e t h e r i o s h a s b i n a r y o p e n m o d e " D I R E C T )
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
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 )
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 )
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 )
# Check existence and uniqueness of long long and __int64.
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_LONG_LONG
" C h e c k i n g w h e t h e r C + + c o m p i l e r h a s ' l o n g l o n g ' " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS___INT64
" C h e c k i n g w h e t h e r C + + c o m p i l e r h a s ' _ _ i n t 6 4 ' " D I R E C T )
IF ( KWSYS_CXX_HAS___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_CXX_HAS_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 ( )
ENDIF ( )
# Enable the "long long" type if it is available. It is standard in
# C99 and C++03 but not in earlier standards.
IF ( KWSYS_CXX_HAS_LONG_LONG )
SET ( KWSYS_USE_LONG_LONG 1 )
ELSE ( )
SET ( KWSYS_USE_LONG_LONG 0 )
ENDIF ( )
# Enable the "__int64" type if it is available and unique. It is not
# standard.
SET ( KWSYS_USE___INT64 0 )
IF ( KWSYS_CXX_HAS___INT64 )
IF ( NOT KWSYS_CXX_SAME_LONG_AND___INT64 )
IF ( NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64 )
SET ( KWSYS_USE___INT64 1 )
ENDIF ( )
ENDIF ( )
ENDIF ( )
IF ( KWSYS_USE_FundamentalType )
# Look for type size helper macros.
KWSYS_PLATFORM_INFO_TEST ( C KWSYS_C_TYPE_MACROS
" C h e c k i n g f o r C t y p e s i z e m a c r o s " )
SET ( macro_regex ".*INFO:macro\\[([^]]*)\\].*" )
FOREACH ( info ${ KWSYS_C_TYPE_MACROS } )
IF ( "${info}" MATCHES "${macro_regex}" )
STRING ( REGEX REPLACE "${macro_regex}" "\\1" macro "${info}" )
SET ( KWSYS_C_HAS_MACRO_ ${ macro } 1 )
ENDIF ( )
ENDFOREACH ( )
# Determine type sizes at preprocessing time if possible, and
# otherwise fall back to a try-compile.
SET ( KWSYS_C_TYPE_NAME_CHAR "char" )
SET ( KWSYS_C_TYPE_NAME_SHORT "short" )
SET ( KWSYS_C_TYPE_NAME_INT "int" )
SET ( KWSYS_C_TYPE_NAME_LONG "long" )
SET ( KWSYS_C_TYPE_NAME_LONG_LONG "long long" )
SET ( KWSYS_C_TYPE_NAME___INT64 "__int64" )
FOREACH ( type CHAR SHORT INT LONG LONG_LONG __INT64 )
IF ( KWSYS_C_HAS_MACRO___SIZEOF_ ${ type } __ )
# Use __SIZEOF_${type}__ macro.
SET ( KWSYS_SIZEOF_ ${ type } TRUE )
SET ( KWSYS_C_CODE_SIZEOF_ ${ type } "#define ${KWSYS_NAMESPACE}_SIZEOF_${type} __SIZEOF_${type}__" )
ELSEIF ( KWSYS_C_HAS_MACRO___ ${ type } _MAX__ )
# Use __${type}_MAX__ macro.
SET ( KWSYS_SIZEOF_ ${ type } TRUE )
SET ( KWSYS_C_CODE_SIZEOF_ ${ type } " #if __${type}_MAX__ == 0x7f
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 1
#elif __${type}_MAX__ == 0x7fff
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 2
#elif __${type}_MAX__ == 0x7fffffff
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 4
#elif __${type}_MAX__>>32 == 0x7fffffff
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 8
#else
# error \"Cannot determine sizeof(${KWSYS_C_TYPE_NAME_${type}}).\"
#endif")
ELSE ( )
# Configure a hard-coded type size.
CHECK_TYPE_SIZE ( "${KWSYS_C_TYPE_NAME_${type}}" KWSYS_SIZEOF_ ${ type } )
IF ( NOT KWSYS_SIZEOF_ ${ type } )
SET ( KWSYS_SIZEOF_ ${ type } 0 )
ENDIF ( )
SET ( KWSYS_C_CODE_SIZEOF_ ${ type }
" #define ${KWSYS_NAMESPACE}_SIZEOF_${type} ${KWSYS_SIZEOF_${type}}")
ENDIF ( )
ENDFOREACH ( )
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.
KWSYS_PLATFORM_CXX_TEST_RUN ( KWSYS_CHAR_IS_SIGNED
" C h e c k i n g w h e t h e r c h a r i s s i g n e d " D I R E C T )
ENDIF ( KWSYS_USE_FundamentalType )
IF ( KWSYS_USE_IOStream )
# Determine whether iostreams support long long.
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES
- D K W S Y S _ I O S _ U S E _ A N S I = $ { K W S Y S _ I O S _ U S E _ A N S I }
- D K W S Y S _ I O S _ H A V E _ S T D = $ { K W S Y S _ I O S _ H A V E _ S T D } )
IF ( KWSYS_CXX_HAS_LONG_LONG )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_HAS_ISTREAM_LONG_LONG
" C h e c k i n g i f i s t r e a m s u p p o r t s l o n g l o n g " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_HAS_OSTREAM_LONG_LONG
" C h e c k i n g i f o s t r e a m s u p p o r t s l o n g l o n g " D I R E C T )
ELSE ( )
SET ( KWSYS_IOS_HAS_ISTREAM_LONG_LONG 0 )
SET ( KWSYS_IOS_HAS_OSTREAM_LONG_LONG 0 )
ENDIF ( )
IF ( KWSYS_CXX_HAS___INT64 )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_HAS_ISTREAM___INT64
" C h e c k i n g i f i s t r e a m s u p p o r t s _ _ i n t 6 4 " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_HAS_OSTREAM___INT64
" C h e c k i n g i f o s t r e a m s u p p o r t s _ _ i n t 6 4 " D I R E C T )
ELSE ( )
SET ( KWSYS_IOS_HAS_ISTREAM___INT64 0 )
SET ( KWSYS_IOS_HAS_OSTREAM___INT64 0 )
ENDIF ( )
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
ENDIF ( KWSYS_USE_IOStream )
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$" )
# 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 )
#-----------------------------------------------------------------------------
# Configure some implementation details.
KWSYS_PLATFORM_C_TEST ( KWSYS_C_HAS_PTRDIFF_T
" C h e c k i n g w h e t h e r C c o m p i l e r h a s p t r d i f f _ t i n s t d d e f . h " D I R E C T )
KWSYS_PLATFORM_C_TEST ( KWSYS_C_HAS_SSIZE_T
" C h e c k i n g w h e t h e r C c o m p i l e r h a s s s i z e _ t i n u n i s t d . h " D I R E C T )
SET_SOURCE_FILES_PROPERTIES ( ProcessUNIX.c System.c PROPERTIES
C O M P I L E _ F L A G S " - D K W S Y S _ C _ H A S _ P T R D I F F _ T = $ { K W S Y S _ C _ H A S _ P T R D I F F _ T } - D K W S Y S _ C _ H A S _ S S I Z E _ T = $ { K W S Y S _ C _ H A S _ S S I Z E _ T } "
)
IF ( KWSYS_USE_SystemTools )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_SETENV
" C h e c k i n g w h e t h e r C X X c o m p i l e r h a s s e t e n v " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_UNSETENV
" C h e c k i n g w h e t h e r C X X c o m p i l e r h a s u n s e t e n v " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
" C h e c k i n g w h e t h e r C X X c o m p i l e r h a s e n v i r o n i n s t d l i b . h " D I R E C T )
SET_SOURCE_FILES_PROPERTIES ( SystemTools.cxx PROPERTIES
C O M P I L E _ F L A G S " - D K W S Y S _ C X X _ H A S _ S E T E N V = $ { K W S Y S _ C X X _ H A S _ S E T E N V } - D K W S Y S _ C X X _ H A S _ U N S E T E N V = $ { K W S Y S _ C X X _ H A S _ U N S E T E N V } - D K W S Y S _ C X X _ H A S _ E N V I R O N _ I N _ S T D L I B _ H = $ { K W S Y S _ C X X _ H A S _ E N V I R O N _ I N _ S T D L I B _ H } " )
ENDIF ( )
IF ( KWSYS_USE_SystemInformation )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S S I Z E O F _ V O I D _ P = $ { C M A K E _ S I Z E O F _ V O I D _ P } )
IF ( NOT CYGWIN )
INCLUDE ( CheckIncludeFiles )
CHECK_INCLUDE_FILES ( "sys/types.h;ifaddrs.h" KWSYS_SYS_HAS_IFADDRS_H )
IF ( KWSYS_SYS_HAS_IFADDRS_H )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ S Y S _ H A S _ I F A D D R S _ H = 1 )
ENDIF ( )
ENDIF ( )
IF ( WIN32 )
INCLUDE ( CheckSymbolExists )
SET ( CMAKE_REQUIRED_LIBRARIES Psapi )
CHECK_SYMBOL_EXISTS ( GetProcessMemoryInfo "windows.h;psapi.h" KWSYS_SYS_HAS_PSAPI )
UNSET ( CMAKE_REQUIRED_LIBRARIES )
IF ( KWSYS_SYS_HAS_PSAPI )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ S Y S _ H A S _ P S A P I = 1 )
IF ( MSVC70 OR MSVC71 )
# Suppress LNK4089: all references to 'PSAPI.DLL' discarded by /OPT:REF
SET ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4089" )
ENDIF ( )
ENDIF ( )
ENDIF ( )
IF ( CMAKE_SYSTEM MATCHES "HP-UX" )
CHECK_INCLUDE_FILES ( "sys/mpctl.h" KWSYS_SYS_HAS_MPCTL_H )
IF ( KWSYS_SYS_HAS_MPCTL_H )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ S Y S _ H A S _ M P C T L _ H = 1 )
ENDIF ( )
ENDIF ( )
IF ( CMAKE_SYSTEM MATCHES "BSD" )
CHECK_INCLUDE_FILES ( "machine/cpu.h" KWSYS_SYS_HAS_MACHINE_CPU_H )
IF ( KWSYS_SYS_HAS_MACHINE_CPU_H )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ S Y S _ H A S _ M A C H I N E _ C P U _ H = 1 )
ENDIF ( )
ENDIF ( )
IF ( KWSYS_LFS_AVAILABLE AND NOT KWSYS_LFS_DISABLE )
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_HAS_LFS=1 )
ENDIF ( )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_RLIMIT64
" C h e c k i n g w h e t h e r C X X c o m p i l e r h a s r l i m i t 6 4 " D I R E C T )
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
IF ( KWSYS_CXX_HAS_RLIMIT64 )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ C X X _ H A S _ R L I M I T 6 4 = 1 )
ENDIF ( )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_ATOL
" C h e c k i n g w h e t h e r C X X c o m p i l e r h a s a t o l " D I R E C T )
IF ( KWSYS_CXX_HAS_ATOL )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ C X X _ H A S _ A T O L = 1 )
ENDIF ( )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_ATOLL
" C h e c k i n g w h e t h e r C X X c o m p i l e r h a s a t o l l " D I R E C T )
IF ( KWSYS_CXX_HAS_ATOLL )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ C X X _ H A S _ A T O L L = 1 )
ENDIF ( )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS__ATOI64
" C h e c k i n g w h e t h e r C X X c o m p i l e r h a s _ a t o i 6 4 " D I R E C T )
IF ( KWSYS_CXX_HAS__ATOI64 )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ C X X _ H A S _ _ A T O I 6 4 = 1 )
ENDIF ( )
IF ( BORLAND )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_BORLAND_ASM
" C h e c k i n g w h e t h e r B o r l a n d C X X c o m p i l e r s u p p o r t s a s s e m b l e r i n s t r u c t i o n s " D I R E C T )
IF ( KWSYS_CXX_HAS_BORLAND_ASM )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ C X X _ H A S _ B O R L A N D _ A S M = 1 )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_BORLAND_ASM_CPUID
" C h e c k i n g w h e t h e r B o r l a n d C X X c o m p i l e r s u p p o r t s C P U I D a s s e m b l e r i n s t r u c t i o n " D I R E C T )
IF ( KWSYS_CXX_HAS_BORLAND_ASM_CPUID )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ C X X _ H A S _ B O R L A N D _ A S M _ C P U I D = 1 )
ENDIF ( )
ENDIF ( )
ENDIF ( )
IF ( KWSYS_USE___INT64 )
SET_PROPERTY ( SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ U S E _ _ _ I N T 6 4 = 1 )
ENDIF ( )
IF ( KWSYS_USE_LONG_LONG )
SET_PROPERTY ( SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ U S E _ L O N G _ L O N G = 1 )
ENDIF ( )
IF ( KWSYS_IOS_HAS_OSTREAM_LONG_LONG )
SET_PROPERTY ( SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ I O S _ H A S _ O S T R E A M _ L O N G _ L O N G = 1 )
ENDIF ( )
IF ( KWSYS_IOS_HAS_OSTREAM___INT64 )
SET_PROPERTY ( SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ I O S _ H A S _ O S T R E A M _ _ _ I N T 6 4 = 1 )
ENDIF ( )
IF ( KWSYS_BUILD_SHARED )
SET_PROPERTY ( SOURCE SystemInformation.cxx APPEND PROPERTY
C O M P I L E _ D E F I N I T I O N S K W S Y S _ B U I L D _ S H A R E D = 1 )
ENDIF ( )
ENDIF ( )
#-----------------------------------------------------------------------------
# Choose a directory for the generated headers.
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}" )
INCLUDE_DIRECTORIES ( ${ KWSYS_HEADER_ROOT } )
#-----------------------------------------------------------------------------
IF ( KWSYS_INSTALL_DOC_DIR )
# Assign the license to the runtime component since it must be
# distributed with binary forms of this software.
IF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
SET ( KWSYS_INSTALL_LICENSE_OPTIONS ${ KWSYS_INSTALL_LICENSE_OPTIONS }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ R U N T I M E }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
# Install the license under the documentation directory.
INSTALL ( FILES ${ CMAKE_CURRENT_SOURCE_DIR } /Copyright.txt
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ D O C _ D I R } / $ { K W S Y S _ N A M E S P A C E }
$ { K W S Y S _ I N S T A L L _ L I C E N S E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_DOC_DIR )
#-----------------------------------------------------------------------------
# Create STL header wrappers to block warnings in the STL headers and
# give standard names by which they may be included.
SET ( KWSYS_STL_HEADER_EXTRA_string 1 )
FOREACH ( header
a l g o r i t h m
d e q u e
e x c e p t i o n
f u n c t i o n a l
i t e r a t o r
l i s t
m a p
m e m o r y
n e w
n u m e r i c
q u e u e
s e t
s t a c k
s t d e x c e p t
s t r i n g
u t i l i t y
v e c t o r
)
# Configure the header wrapper.
SET ( KWSYS_STL_HEADER "${header}" )
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_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } /stl/ ${ header } .hxx
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ I N C L U D E _ D I R } / $ { K W S Y S _ N A M E S P A C E } / s t l
$ { K W S Y S _ I N S T A L L _ I N C L U D E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_INCLUDE_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
$ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r }
@ O N L Y I M M E D I A T E )
# Create an install target for the header wrapper.
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } /stl/ ${ header }
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ I N C L U D E _ D I R } / $ { K W S Y S _ N A M E S P A C E } / s t l
$ { K W S Y S _ I N S T A L L _ I N C L U D E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
ENDFOREACH ( header )
# 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 )
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } /cstddef
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ I N C L U D E _ D I R } / $ { K W S Y S _ N A M E S P A C E }
$ { K W S Y S _ I N S T A L L _ I N C L U D E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
#-----------------------------------------------------------------------------
# Create streams header wrappers to give standard names by which they
# may be included.
FOREACH ( header iostream fstream sstream iosfwd )
# Configure the header wrapper.
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 }
@ O N L Y I M M E D I A T E )
# Create an install target for the header wrapper.
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } /ios/ ${ header }
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ I N C L U D E _ D I R } / $ { K W S Y S _ N A M E S P A C E } / i o s
$ { K W S Y S _ I N S T A L L _ I N C L U D E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
ENDFOREACH ( header )
#-----------------------------------------------------------------------------
# Build a list of classes and headers we need to implement the
# selected components. Initialize with required components.
SET ( KWSYS_CLASSES )
SET ( KWSYS_H_FILES Configure SharedForward )
SET ( KWSYS_HXX_FILES Configure String
h a s h t a b l e h a s h _ f u n h a s h _ m a p h a s h _ s e t
a u t o _ p t r
)
# Add selected C++ classes.
SET ( cppclasses
D i r e c t o r y D y n a m i c L o a d e r G l o b R e g u l a r E x p r e s s i o n S y s t e m T o o l s
C o m m a n d L i n e A r g u m e n t s I O S t r e a m S y s t e m I n f o r m a t i o n
)
FOREACH ( cpp ${ cppclasses } )
IF ( KWSYS_USE_ ${ cpp } )
# Use the corresponding class.
SET ( KWSYS_CLASSES ${ KWSYS_CLASSES } ${ cpp } )
# Load component-specific CMake code.
IF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ cpp } .cmake )
INCLUDE ( ${ PROJECT_SOURCE_DIR } /kwsys ${ cpp } .cmake )
ENDIF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ cpp } .cmake )
ENDIF ( KWSYS_USE_ ${ cpp } )
ENDFOREACH ( cpp )
# Add selected C components.
FOREACH ( c
P r o c e s s B a s e 6 4 F u n d a m e n t a l T y p e M D 5 T e r m i n a l S y s t e m S t r i n g C P U
)
IF ( KWSYS_USE_ ${ c } )
# Use the corresponding header file.
SET ( KWSYS_H_FILES ${ KWSYS_H_FILES } ${ c } )
# Load component-specific CMake code.
IF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ c } .cmake )
INCLUDE ( ${ PROJECT_SOURCE_DIR } /kwsys ${ c } .cmake )
ENDIF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ c } .cmake )
ENDIF ( KWSYS_USE_ ${ c } )
ENDFOREACH ( c )
#-----------------------------------------------------------------------------
# Build a list of sources for the library based on components that are
# included.
SET ( KWSYS_C_SRCS )
SET ( KWSYS_CXX_SRCS )
# Add the proper sources for this platform's Process implementation.
IF ( KWSYS_USE_Process )
IF ( NOT UNIX )
# Use the Windows implementation.
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessWin32.c )
ELSE ( NOT UNIX )
# Use the UNIX implementation.
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessUNIX.c )
ENDIF ( NOT UNIX )
ENDIF ( KWSYS_USE_Process )
# Add selected C sources.
FOREACH ( c Base64 MD5 Terminal System String )
IF ( KWSYS_USE_ ${ c } )
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ${ c } .c )
ENDIF ( KWSYS_USE_ ${ c } )
ENDFOREACH ( c )
# 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.
SET ( KWSYS_CXX_SRCS ${ KWSYS_CXX_SRCS } ${ c } .cxx )
# Configure the header for this class.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ c } .hxx.in ${ KWSYS_HEADER_DIR } / ${ c } .hxx
@ O N L Y I M M E D I A T E )
SET ( KWSYS_CXX_SRCS ${ KWSYS_CXX_SRCS } ${ KWSYS_HEADER_DIR } / ${ c } .hxx )
# Create an install target for the header.
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } / ${ c } .hxx
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ I N C L U D E _ D I R } / $ { K W S Y S _ N A M E S P A C E }
$ { K W S Y S _ I N S T A L L _ I N C L U D E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
ENDFOREACH ( c )
# 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
@ O N L Y I M M E D I A T E )
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ${ KWSYS_HEADER_DIR } / ${ h } .h )
# Create an install target for the header.
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } / ${ h } .h
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ I N C L U D E _ D I R } / $ { K W S Y S _ N A M E S P A C E }
$ { K W S Y S _ I N S T A L L _ I N C L U D E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
ENDFOREACH ( h )
# 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
@ O N L Y I M M E D I A T E )
SET ( KWSYS_CXX_SRCS ${ KWSYS_CXX_SRCS } ${ KWSYS_HEADER_DIR } / ${ h } .hxx )
# Create an install target for the header.
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } / ${ h } .hxx
D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ I N C L U D E _ D I R } / $ { K W S Y S _ N A M E S P A C E }
$ { K W S Y S _ I N S T A L L _ I N C L U D E _ O P T I O N S } )
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
ENDFOREACH ( h )
#-----------------------------------------------------------------------------
# Add the library with the configured name and list of sources.
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 } )
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } PROPERTY LABELS ${ KWSYS_LABELS_LIB } )
IF ( KWSYS_USE_DynamicLoader )
IF ( UNIX )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ${ CMAKE_DL_LIBS } )
ENDIF ( UNIX )
ENDIF ( KWSYS_USE_DynamicLoader )
IF ( KWSYS_USE_SystemInformation AND WIN32 )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ws2_32 )
IF ( KWSYS_SYS_HAS_PSAPI )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } Psapi )
ENDIF ( )
ENDIF ( KWSYS_USE_SystemInformation AND WIN32 )
# 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 )
# Create an install target for the library.
IF ( KWSYS_INSTALL_LIBRARY_RULE )
INSTALL ( TARGETS ${ KWSYS_NAMESPACE } ${ KWSYS_INSTALL_LIBRARY_RULE } )
ENDIF ( KWSYS_INSTALL_LIBRARY_RULE )
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 } )
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } _c PROPERTY LABELS ${ KWSYS_LABELS_LIB } )
# 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 )
# Create an install target for the library.
IF ( KWSYS_INSTALL_LIBRARY_RULE )
INSTALL ( TARGETS ${ KWSYS_NAMESPACE } _c ${ KWSYS_INSTALL_LIBRARY_RULE } )
ENDIF ( KWSYS_INSTALL_LIBRARY_RULE )
ENDIF ( KWSYS_ENABLE_C AND KWSYS_C_SRCS )
# For building kwsys itself, we use a macro defined on the command
# line to configure the namespace in the C and C++ source files.
ADD_DEFINITIONS ( "-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}" )
# Disable deprecation warnings for standard C functions.
IF ( MSVC OR ( WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$" ) )
ADD_DEFINITIONS (
- D _ C R T _ N O N S T D C _ N O _ D E P R E C A T E
- D _ C R T _ S E C U R E _ N O _ D E P R E C A T E
- D _ C R T _ S E C U R E _ N O _ W A R N I N G S
- D _ S C L _ S E C U R E _ N O _ D E P R E C A T E
)
ENDIF ( )
IF ( KWSYS_USE_String )
# Activate code in "String.c". See the comment in the source.
SET_SOURCE_FILES_PROPERTIES ( String.c PROPERTIES
C O M P I L E _ F L A G S " - D K W S Y S _ S T R I N G _ C " )
ENDIF ( KWSYS_USE_String )
#-----------------------------------------------------------------------------
# Setup testing if not being built as part of another project.
IF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
IF ( BUILD_TESTING )
# Compute the location of executables.
SET ( EXEC_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
IF ( EXECUTABLE_OUTPUT_PATH )
SET ( EXEC_DIR "${EXECUTABLE_OUTPUT_PATH}" )
ENDIF ( EXECUTABLE_OUTPUT_PATH )
# C tests
SET ( KWSYS_C_TESTS
t e s t E n c o d e
t e s t T e r m i n a l
)
IF ( KWSYS_STANDALONE )
SET ( KWSYS_C_TESTS ${ KWSYS_C_TESTS } testFail )
ENDIF ( )
CREATE_TEST_SOURCELIST (
K W S Y S _ C _ T E S T _ S R C S $ { K W S Y S _ N A M E S P A C E } T e s t s C . c
$ { K W S Y S _ C _ T E S T S }
)
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } TestsC ${ KWSYS_C_TEST_SRCS } )
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestsC PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } TestsC ${ KWSYS_NAMESPACE } _c )
FOREACH ( test ${ KWSYS_C_TESTS } )
ADD_TEST ( kwsys. ${ test } ${ EXEC_DIR } / ${ KWSYS_NAMESPACE } TestsC ${ test } ${ KWSYS_TEST_ARGS_${test } } )
SET_PROPERTY ( TEST kwsys. ${ test } PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
ENDFOREACH ( test )
# C++ tests
IF ( NOT WATCOM )
SET ( KWSYS_CXX_TESTS
t e s t A u t o P t r
t e s t H a s h S T L
)
ENDIF ( NOT WATCOM )
SET ( KWSYS_CXX_TESTS ${ KWSYS_CXX_TESTS }
t e s t I O S
t e s t S y s t e m T o o l s
t e s t C o m m a n d L i n e A r g u m e n t s
t e s t C o m m a n d L i n e A r g u m e n t s 1
)
IF ( KWSYS_USE_SystemInformation )
SET ( KWSYS_CXX_TESTS ${ KWSYS_CXX_TESTS } testSystemInformation )
ENDIF ( KWSYS_USE_SystemInformation )
IF ( KWSYS_USE_DynamicLoader )
SET ( KWSYS_CXX_TESTS ${ KWSYS_CXX_TESTS } testDynamicLoader )
# If kwsys contains the DynamicLoader, need extra library
ADD_LIBRARY ( ${ KWSYS_NAMESPACE } TestDynload MODULE testDynload.c )
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestDynload PROPERTY LABELS ${ KWSYS_LABELS_LIB } )
ADD_DEPENDENCIES ( ${ KWSYS_NAMESPACE } TestDynload ${ KWSYS_NAMESPACE } )
ENDIF ( KWSYS_USE_DynamicLoader )
CREATE_TEST_SOURCELIST (
K W S Y S _ C X X _ T E S T _ S R C S $ { K W S Y S _ N A M E S P A C E } T e s t s C x x . c x x
$ { K W S Y S _ C X X _ T E S T S }
)
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } TestsCxx ${ KWSYS_CXX_TEST_SRCS } )
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestsCxx PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } TestsCxx ${ KWSYS_NAMESPACE } )
SET ( TEST_SYSTEMTOOLS_BIN_FILE
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t S y s t e m T o o l s . b i n " )
SET ( TEST_SYSTEMTOOLS_SRC_FILE
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t S y s t e m T o o l s . c x x " )
CONFIGURE_FILE (
$ { P R O J E C T _ S O U R C E _ D I R } / t e s t S y s t e m T o o l s . h . i n
$ { P R O J E C T _ B I N A R Y _ D I R } / t e s t S y s t e m T o o l s . h )
INCLUDE_DIRECTORIES ( ${ PROJECT_BINARY_DIR } )
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 )
SET ( KWSYS_TEST_ARGS_testCommandLineArguments
- - a n o t h e r - b o o l - v a r i a b l e
- - l o n g 3 = o p t
- - s e t - b o o l - a r g 1
- S S S k e n b r a d b i l l a n d y
- - s o m e - b o o l - v a r i a b l e = t r u e
- - s o m e - d o u b l e - v a r i a b l e 1 2 . 5
- - s o m e - i n t - v a r i a b l e 1 4
" - - s o m e - s t r i n g - v a r i a b l e = t e s t s t r i n g w i t h s p a c e "
- - s o m e - m u l t i - a r g u m e n t 5 1 8 3 7 1 3 9 7 1
- N 1 2 . 5 - S S = a n d y - N 1 . 3 1 - N 2 2
- S S = b i l l - B B t r u e - S S = b r a d
- B B t r u e
- B B f a l s e
- S S = k e n
- A
- C = t e s t
- - l o n g 2 h e l l o
)
SET ( KWSYS_TEST_ARGS_testCommandLineArguments1
- - i g n o r e d
- n 2 4
- - s e c o n d - i g n o r e d
" - m = t e s t v a l u e "
t h i r d - i g n o r e d
- p
s o m e j u n k a t t h e e n d
)
FOREACH ( test ${ KWSYS_CXX_TESTS } )
ADD_TEST ( kwsys. ${ test } ${ EXEC_DIR } / ${ KWSYS_NAMESPACE } TestsCxx ${ test } ${ KWSYS_TEST_ARGS_${test } } )
SET_PROPERTY ( TEST kwsys. ${ test } PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
ENDFOREACH ( test )
# Process tests.
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } TestProcess testProcess.c )
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestProcess PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } TestProcess ${ KWSYS_NAMESPACE } _c )
IF ( NOT CYGWIN )
SET ( KWSYS_TEST_PROCESS_7 7 )
ENDIF ( NOT CYGWIN )
FOREACH ( n 1 2 3 4 5 6 ${ KWSYS_TEST_PROCESS_7 } )
ADD_TEST ( kwsys.testProcess- ${ n } ${ EXEC_DIR } / ${ KWSYS_NAMESPACE } TestProcess ${ n } )
SET_PROPERTY ( TEST kwsys.testProcess- ${ n } PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
SET_TESTS_PROPERTIES ( kwsys.testProcess- ${ n } PROPERTIES TIMEOUT 120 )
ENDFOREACH ( n )
# Some Apple compilers produce bad optimizations in this source.
IF ( APPLE AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|LLVM)$" )
SET_SOURCE_FILES_PROPERTIES ( testProcess.c PROPERTIES COMPILE_FLAGS -O0 )
ENDIF ( )
# Test SharedForward
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /testSharedForward.c.in
$ { P R O J E C T _ B I N A R Y _ D I R } / t e s t S h a r e d F o r w a r d . c @ O N L Y I M M E D I A T E )
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } TestSharedForward
$ { P R O J E C T _ B I N A R Y _ D I R } / t e s t S h a r e d F o r w a r d . c )
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestSharedForward PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
ADD_DEPENDENCIES ( ${ KWSYS_NAMESPACE } TestSharedForward ${ KWSYS_NAMESPACE } _c )
ADD_TEST ( kwsys.testSharedForward ${ EXEC_DIR } / ${ KWSYS_NAMESPACE } TestSharedForward 1 )
SET_PROPERTY ( TEST kwsys.testSharedForward PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
# Configure some test properties.
IF ( KWSYS_STANDALONE )
# We expect test to fail
SET_TESTS_PROPERTIES ( kwsys.testFail PROPERTIES WILL_FAIL ON )
GET_TEST_PROPERTY ( kwsys.testFail WILL_FAIL wfv )
SET_TESTS_PROPERTIES ( kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value" )
MESSAGE ( STATUS "GET_TEST_PROPERTY returned: ${wfv}" )
ENDIF ( )
# Suppress known consistent failures on buggy systems.
IF ( KWSYS_TEST_BOGUS_FAILURES )
SET_TESTS_PROPERTIES ( ${ KWSYS_TEST_BOGUS_FAILURES } PROPERTIES WILL_FAIL ON )
ENDIF ( )
ENDIF ( BUILD_TESTING )
ENDIF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )