2012-05-02 16:46:10 +04:00
#=============================================================================
# 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 )
2014-03-12 18:58:16 +04:00
IF ( POLICY CMP0025 )
CMAKE_POLICY ( SET CMP0025 NEW )
ENDIF ( )
2015-05-27 20:15:22 +03:00
IF ( POLICY CMP0056 )
CMAKE_POLICY ( SET CMP0056 NEW )
ENDIF ( )
2012-05-02 16:46:10 +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.
IF ( NOT KWSYS_NAMESPACE )
SET ( KWSYS_NAMESPACE "kwsys" )
SET ( KWSYS_STANDALONE 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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 )
2013-11-21 21:47:57 +04:00
SET ( KWSYS_USE_Encoding 1 )
2012-05-02 16:46:10 +04:00
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 )
2013-11-21 21:47:57 +04:00
SET ( KWSYS_USE_FStream 1 )
2012-05-02 16:46:10 +04:00
SET ( KWSYS_USE_String 1 )
SET ( KWSYS_USE_SystemInformation 1 )
SET ( KWSYS_USE_CPU 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# Enforce component dependencies.
IF ( KWSYS_USE_SystemTools )
SET ( KWSYS_USE_Directory 1 )
2013-11-21 21:47:57 +04:00
SET ( KWSYS_USE_FStream 1 )
SET ( KWSYS_USE_Encoding 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_USE_Glob )
SET ( KWSYS_USE_Directory 1 )
SET ( KWSYS_USE_SystemTools 1 )
SET ( KWSYS_USE_RegularExpression 1 )
2013-11-21 21:47:57 +04:00
SET ( KWSYS_USE_FStream 1 )
SET ( KWSYS_USE_Encoding 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_USE_Process )
SET ( KWSYS_USE_System 1 )
2013-11-21 21:47:57 +04:00
SET ( KWSYS_USE_Encoding 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_USE_SystemInformation )
SET ( KWSYS_USE_Process 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2013-11-21 21:47:57 +04:00
IF ( KWSYS_USE_System )
SET ( KWSYS_USE_Encoding 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2013-11-21 21:47:57 +04:00
IF ( KWSYS_USE_Directory )
SET ( KWSYS_USE_Encoding 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2013-11-21 21:47:57 +04:00
IF ( KWSYS_USE_FStream )
SET ( KWSYS_USE_Encoding 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# Setup the large file support default.
IF ( KWSYS_LFS_DISABLE )
SET ( KWSYS_LFS_REQUESTED 0 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
SET ( KWSYS_LFS_REQUESTED 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
2013-11-21 21:47:57 +04:00
# Specify default 8 bit encoding for Windows
IF ( NOT KWSYS_ENCODING_DEFAULT_CODEPAGE )
SET ( KWSYS_ENCODING_DEFAULT_CODEPAGE CP_ACP )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2013-11-21 21:47:57 +04:00
2012-05-02 16:46:10 +04:00
# Enable testing if building standalone.
IF ( KWSYS_STANDALONE )
INCLUDE ( Dart )
MARK_AS_ADVANCED ( BUILD_TESTING DART_ROOT TCL_TCLSH )
IF ( BUILD_TESTING )
ENABLE_TESTING ( )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 } " )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 } " )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 } " )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 }
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 }
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 }
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 }
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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
2014-10-31 20:09:11 +03:00
$ { 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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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}" )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +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" )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include" )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( CMAKE_SYSTEM MATCHES "HP-UX" )
SET ( KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p" )
2014-04-07 17:49:13 +04:00
IF ( CMAKE_CXX_COMPILER_ID MATCHES "HP" )
# it is known that version 3.85 fails and 6.25 works without these flags
IF ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4 )
# use new C++ library and improved template support
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98" )
ENDIF ( )
ENDIF ( )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ELSE ( )
2012-05-02 16:46:10 +04:00
# Large File Support is not requested.
SET ( KWSYS_LFS_REQUESTED 0 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
SET ( KWSYS_IOS_HAVE_STD 0 )
SET ( KWSYS_IOS_USE_SSTREAM 0 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_IOS_USE_SSTREAM )
SET ( KWSYS_IOS_USE_STRSTREAM_H 0 )
SET ( KWSYS_IOS_USE_STRSTREA_H 0 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +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 )
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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +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 )
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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
# 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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
SET ( KWSYS_CAN_CONVERT_UI64_TO_DOUBLE 1 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
2013-11-21 21:47:57 +04:00
IF ( KWSYS_USE_Encoding )
# Look for type size helper macros.
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_WSTRING
" C h e c k i n g w h e t h e r w s t r i n g i s a v a i l a b l e " D I R E C T )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2013-11-21 21:47:57 +04:00
2012-05-02 16:46:10 +04:00
IF ( KWSYS_USE_IOStream )
# Determine whether iostreams support long long.
2012-10-17 01:12:23 +04:00
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 } )
2012-05-02 16:46:10 +04:00
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 ( )
2012-10-17 01:12:23 +04:00
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_NAMESPACE MATCHES "^kwsys$" )
SET ( KWSYS_NAME_IS_KWSYS 1 )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
SET ( KWSYS_NAME_IS_KWSYS 0 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_BUILD_SHARED )
SET ( KWSYS_BUILD_SHARED 1 )
SET ( KWSYS_LIBRARY_TYPE SHARED )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
SET ( KWSYS_BUILD_SHARED 0 )
SET ( KWSYS_LIBRARY_TYPE STATIC )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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 )
2013-06-01 00:34:02 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_UTIMES
" 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 t i m e s " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_UTIMENSAT
" 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 t i m e n s a t " D I R E C T )
SET_PROPERTY ( SOURCE SystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS
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 }
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 }
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 }
K W S Y S _ C X X _ H A S _ U T I M E S = $ { K W S Y S _ C X X _ H A S _ U T I M E S }
K W S Y S _ C X X _ H A S _ U T I M E N S A T = $ { K W S Y S _ C X X _ H A S _ U T I M E N S A T }
)
2012-05-02 16:46:10 +04:00
ENDIF ( )
IF ( KWSYS_USE_SystemInformation )
2013-01-14 18:26:01 +04:00
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 } )
2012-10-01 22:58:49 +04:00
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 ( )
2013-01-07 19:20:26 +04:00
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 ( )
2013-01-10 21:34:34 +04:00
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 ( )
2012-10-17 01:12:23 +04:00
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 ( )
2013-08-06 17:10:11 +04:00
IF ( UNIX )
INCLUDE ( CheckIncludeFileCXX )
# check for simple stack trace
# usually it's in libc but on FreeBSD
# it's in libexecinfo
FIND_LIBRARY ( EXECINFO_LIB "execinfo" )
2014-03-03 17:32:13 +04:00
MARK_AS_ADVANCED ( EXECINFO_LIB )
2013-08-06 17:10:11 +04:00
IF ( NOT EXECINFO_LIB )
SET ( EXECINFO_LIB "" )
ENDIF ( )
CHECK_INCLUDE_FILE_CXX ( "execinfo.h" KWSYS_CXX_HAS_EXECINFOH )
IF ( KWSYS_CXX_HAS_EXECINFOH )
# we have the backtrace header check if it
# can be used with this compiler
SET ( KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES ${ EXECINFO_LIB } )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_BACKTRACE
" C h e c k i n g w h e t h e r b a c k t r a c e w o r k s w i t h t h i s C + + c o m p i l e r " D I R E C T )
SET ( KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES )
IF ( KWSYS_CXX_HAS_BACKTRACE )
# backtrace is supported by this system and compiler.
# now check for the more advanced capabilities.
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 T E M I N F O R M A T I O N _ H A S _ B A C K T R A C E = 1 )
# check for symbol lookup using dladdr
CHECK_INCLUDE_FILE_CXX ( "dlfcn.h" KWSYS_CXX_HAS_DLFCNH )
IF ( KWSYS_CXX_HAS_DLFCNH )
# we have symbol lookup libraries and headers
# check if they can be used with this compiler
SET ( KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES ${ CMAKE_DL_LIBS } )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_DLADDR
" C h e c k i n g w h e t h e r d l a d d r w o r k s w i t h t h i s C + + c o m p i l e r " D I R E C T )
SET ( KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES )
IF ( KWSYS_CXX_HAS_DLADDR )
# symbol lookup is supported by this system
# and compiler.
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 T E M I N F O R M A T I O N _ H A S _ S Y M B O L _ L O O K U P = 1 )
ENDIF ( )
ENDIF ( )
# c++ demangling support
# check for cxxabi headers
CHECK_INCLUDE_FILE_CXX ( "cxxabi.h" KWSYS_CXX_HAS_CXXABIH )
IF ( KWSYS_CXX_HAS_CXXABIH )
# check if cxxabi can be used with this
# system and compiler.
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_CXXABI
" C h e c k i n g w h e t h e r c x x a b i w o r k s w i t h t h i s C + + c o m p i l e r " D I R E C T )
IF ( KWSYS_CXX_HAS_CXXABI )
# c++ demangle using cxxabi is supported with
# this system and compiler
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 T E M I N F O R M A T I O N _ H A S _ C P P _ D E M A N G L E = 1 )
ENDIF ( )
ENDIF ( )
# basic backtrace works better with release build
# don't bother with advanced features for release
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 _ D E B U G K W S Y S _ S Y S T E M I N F O R M A T I O N _ H A S _ D E B U G _ B U I L D = 1 )
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 _ R E L W I T H D E B I N F O K W S Y S _ S Y S T E M I N F O R M A T I O N _ H A S _ D E B U G _ B U I L D = 1 )
ENDIF ( )
ENDIF ( )
ENDIF ( )
2013-01-14 18:26:01 +04:00
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 ( )
2012-10-17 01:12:23 +04:00
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 ( )
2015-06-03 21:25:01 +03:00
IF ( UNIX AND NOT CYGWIN )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_GETLOADAVG
" 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 g e t l o a d a v g " D I R E C T )
IF ( KWSYS_CXX_HAS_GETLOADAVG )
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 _ G E T L O A D A V G = 1 )
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
ENDIF ( )
#-----------------------------------------------------------------------------
# Choose a directory for the generated headers.
IF ( NOT KWSYS_HEADER_ROOT )
SET ( KWSYS_HEADER_ROOT "${PROJECT_BINARY_DIR}" )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 }
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ELSE ( )
2012-05-02 16:46:10 +04:00
SET ( KWSYS_STL_HEADER_EXTRA "" )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +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 )
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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +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.
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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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
2013-11-21 21:47:57 +04:00
D i r e c t o r y D y n a m i c L o a d e r E n c o d i n g 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 F S t r e a m S y s t e m I n f o r m a t i o n
2012-05-02 16:46:10 +04:00
)
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +04:00
# Add selected C components.
FOREACH ( c
2013-11-21 21:47:57 +04:00
P r o c e s s B a s e 6 4 E n c o d i n g 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
2012-05-02 16:46:10 +04:00
)
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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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 )
2012-12-19 17:02:08 +04:00
# Use the Windows implementation.
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessWin32.c )
2014-11-12 16:57:35 +03:00
ELSE ( )
2012-05-02 16:46:10 +04:00
# Use the UNIX implementation.
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessUNIX.c )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
# Add selected C sources.
2013-11-21 21:47:57 +04:00
FOREACH ( c Base64 Encoding MD5 Terminal System String )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_USE_ ${ c } )
2013-11-21 21:47:57 +04:00
IF ( EXISTS ${ CMAKE_CURRENT_SOURCE_DIR } / ${ c } C.c )
LIST ( APPEND KWSYS_C_SRCS ${ c } C.c )
ELSE ( )
LIST ( APPEND KWSYS_C_SRCS ${ c } .c )
ENDIF ( )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +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.
2013-11-21 21:47:57 +04:00
IF ( EXISTS ${ CMAKE_CURRENT_SOURCE_DIR } / ${ c } CXX.cxx )
LIST ( APPEND KWSYS_CXX_SRCS ${ c } CXX.cxx )
ELSEIF ( EXISTS ${ CMAKE_CURRENT_SOURCE_DIR } / ${ c } .cxx )
LIST ( APPEND KWSYS_CXX_SRCS ${ c } .cxx )
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +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
@ 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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +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
@ 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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDFOREACH ( )
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-10-01 22:58:49 +04:00
2013-08-06 17:10:11 +04:00
IF ( KWSYS_USE_SystemInformation )
IF ( WIN32 )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ws2_32 )
IF ( KWSYS_SYS_HAS_PSAPI )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } Psapi )
ENDIF ( )
ELSEIF ( UNIX )
IF ( EXECINFO_LIB AND KWSYS_CXX_HAS_BACKTRACE )
# backtrace on FreeBSD is not in libc
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ${ EXECINFO_LIB } )
ENDIF ( )
IF ( KWSYS_CXX_HAS_DLADDR )
# for symbol lookup using dladdr
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ${ CMAKE_DL_LIBS } )
ENDIF ( )
2012-10-01 22:58:49 +04:00
ENDIF ( )
2013-08-06 17:10:11 +04:00
ENDIF ( )
2012-05-02 16:46:10 +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 }
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# Create an install target for the library.
IF ( KWSYS_INSTALL_LIBRARY_RULE )
INSTALL ( TARGETS ${ KWSYS_NAMESPACE } ${ KWSYS_INSTALL_LIBRARY_RULE } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 }
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# Create an install target for the library.
IF ( KWSYS_INSTALL_LIBRARY_RULE )
INSTALL ( TARGETS ${ KWSYS_NAMESPACE } _c ${ KWSYS_INSTALL_LIBRARY_RULE } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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}" )
2012-10-01 22:58:49 +04:00
# Disable deprecation warnings for standard C functions.
2014-10-31 20:09:11 +03:00
IF ( MSVC OR ( WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel" ) )
2012-10-01 22:58:49 +04:00
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 ( )
2014-03-03 17:32:13 +04:00
IF ( WIN32 )
# Help enforce the use of wide Windows apis.
ADD_DEFINITIONS ( -DUNICODE -D_UNICODE )
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 " )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
2013-11-21 21:47:57 +04:00
IF ( KWSYS_USE_Encoding )
# Set default 8 bit encoding in "EndcodingC.c".
SET_PROPERTY ( SOURCE EncodingC.c APPEND PROPERTY COMPILE_DEFINITIONS
K W S Y S _ E N C O D I N G _ D E F A U L T _ C O D E P A G E = $ { K W S Y S _ E N C O D I N G _ D E F A U L T _ C O D E P A G E } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2013-11-21 21:47:57 +04:00
2012-05-02 16:46:10 +04:00
#-----------------------------------------------------------------------------
# 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}" )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
# 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 } )
2014-11-12 16:57:35 +03:00
ENDFOREACH ( )
2012-05-02 16:46:10 +04:00
# 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
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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
)
2013-11-21 21:47:57 +04:00
IF ( KWSYS_STL_HAS_WSTRING )
SET ( KWSYS_CXX_TESTS ${ KWSYS_CXX_TESTS }
t e s t E n c o d i n g
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2013-12-22 03:58:02 +04:00
IF ( KWSYS_USE_FStream )
SET ( KWSYS_CXX_TESTS ${ KWSYS_CXX_TESTS }
t e s t F S t r e a m
)
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
IF ( KWSYS_USE_SystemInformation )
SET ( KWSYS_CXX_TESTS ${ KWSYS_CXX_TESTS } testSystemInformation )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 } )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 } )
2014-07-02 18:57:17 +04:00
SET ( TEST_SYSTEMTOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
SET ( TEST_SYSTEMTOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
2012-05-02 16:46:10 +04:00
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" )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 } )
2014-11-12 16:57:35 +03:00
ENDFOREACH ( )
2012-05-02 16:46:10 +04:00
# 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 )
2014-11-12 16:57:35 +03:00
ENDIF ( )
2012-05-02 16:46:10 +04:00
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 )
2014-11-12 16:57:35 +03:00
ENDFOREACH ( )
2012-05-02 16:46:10 +04:00
# Some Apple compilers produce bad optimizations in this source.
2014-10-31 20:09:11 +03:00
IF ( APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$" )
2012-05-02 16:46:10 +04:00
SET_SOURCE_FILES_PROPERTIES ( testProcess.c PROPERTIES COMPILE_FLAGS -O0 )
2014-03-06 22:01:40 +04:00
ELSEIF ( CMAKE_C_COMPILER_ID STREQUAL "XL" )
# Tell IBM XL not to warn about our test infinite loop
SET_PROPERTY ( SOURCE testProcess.c PROPERTY COMPILE_FLAGS -qsuppress=1500-010 )
2012-05-02 16:46:10 +04:00
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 ( )
2014-11-12 16:57:35 +03:00
ENDIF ( )
ENDIF ( )