2003-06-20 02:57:11 +04:00
#=============================================================================
2009-09-28 19:37:35 +04:00
# KWSys - Kitware System Library
2011-03-01 23:34:10 +03:00
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
2003-06-20 02:57:11 +04:00
#
2009-09-28 19:37:35 +04:00
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
2003-06-20 02:57:11 +04:00
#
2009-09-28 19:37:35 +04:00
# 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.
2003-06-20 02:57:11 +04:00
#=============================================================================
# The Kitware System Library is intended to be included in other
# projects. It is completely configurable in that the library's
2003-06-26 21:39:35 +04:00
# namespace can be configured and the components that are included can
# be selected invididually.
2003-06-20 02:57:11 +04:00
# Typical usage is to import the kwsys directory tree into a
2003-06-26 21:39:35 +04:00
# subdirectory under a parent project and enable the classes that will
# be used. All classes are disabled by default. The CMake listfile
# above this one configures the library as follows:
2003-06-20 02:57:11 +04:00
#
2003-06-26 21:39:35 +04:00
# SET(KWSYS_NAMESPACE foosys)
# SET(KWSYS_USE_Directory 1) # Enable Directory class.
2003-06-20 02:57:11 +04:00
# SUBDIRS(kwsys)
#
# Optional settings are as follows:
#
2003-06-20 22:10:28 +04:00
# KWSYS_HEADER_ROOT = The directory into which to generate the kwsys headers.
# A directory called "${KWSYS_NAMESPACE}" will be
# created under this root directory to hold the files.
2003-06-20 02:57:11 +04:00
#
# Example:
#
2003-07-08 17:21:45 +04:00
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
2003-06-20 02:57:11 +04:00
#
2006-07-05 18:06:31 +04:00
# KWSYS_IOS_FORCE_OLD = Force use of old non-ANSI C++ streams even if
# new streams are available. This may be used
# by projects that cannot configure their
# streams library.
# Example:
#
# SET(KWSYS_IOS_FORCE_OLD 1)
#
#
2011-03-01 23:34:10 +03:00
# Optional settings to setup install rules are as follows:
2006-07-05 18:06:31 +04:00
#
# 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 '/'.
2009-09-28 19:36:54 +04:00
# KWSYS_INSTALL_DOC_DIR = The installation target directory for documentation
# such as copyright information.
2006-07-05 18:06:31 +04:00
#
# 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.
#
2010-12-02 00:02:50 +03:00
# KWSYS_INSTALL_EXPORT_NAME = The EXPORT option value for install(TARGETS) calls.
#
2006-07-05 18:06:31 +04:00
# 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)
2003-06-20 02:57:11 +04:00
# Once configured, kwsys should be used as follows from C or C++ code:
#
2003-06-26 21:39:35 +04:00
# #include <foosys/Directory.hxx>
2003-06-20 02:57:11 +04:00
# ...
2003-06-26 21:39:35 +04:00
# foosys::Directory directory;
2003-06-20 02:57:11 +04:00
#
2005-09-19 01:08:56 +04:00
# 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.
2011-03-01 23:34:10 +03:00
CMAKE_MINIMUM_REQUIRED ( VERSION 2.6.3 FATAL_ERROR )
2009-11-20 16:37:10 +03:00
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# If a namespace is not specified, use "kwsys" and enable testing.
# This should be the case only when kwsys is not included inside
# another project and is being tested.
2003-05-08 22:17:26 +04:00
IF ( NOT KWSYS_NAMESPACE )
SET ( KWSYS_NAMESPACE "kwsys" )
2003-06-20 02:57:11 +04:00
SET ( KWSYS_STANDALONE 1 )
2005-04-13 21:57:24 +04:00
ENDIF ( NOT KWSYS_NAMESPACE )
2007-03-03 18:47:06 +03:00
#-----------------------------------------------------------------------------
# The project name is that of the specified namespace.
PROJECT ( ${ KWSYS_NAMESPACE } )
2008-05-14 19:55:41 +04:00
# Tell CMake how to follow dependencies of sources in this directory.
2011-03-01 23:34:10 +03:00
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 } / % > "
)
2008-05-14 19:55:41 +04:00
2007-03-03 18:47:06 +03:00
# Select library components.
2005-04-13 21:57:24 +04:00
IF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
2004-07-03 01:39:47 +04:00
SET ( KWSYS_ENABLE_C 1 )
2003-06-20 02:57:11 +04:00
# Enable all components.
2003-06-30 16:48:31 +04:00
SET ( KWSYS_USE_Base64 1 )
2003-06-20 02:57:11 +04:00
SET ( KWSYS_USE_Directory 1 )
2006-03-06 22:07:50 +03:00
SET ( KWSYS_USE_DynamicLoader 1 )
2005-10-18 22:08:55 +04:00
SET ( KWSYS_USE_Glob 1 )
2007-03-14 22:12:10 +03:00
SET ( KWSYS_USE_MD5 1 )
2003-06-30 16:48:31 +04:00
SET ( KWSYS_USE_Process 1 )
2003-06-20 02:57:11 +04:00
SET ( KWSYS_USE_RegularExpression 1 )
2006-09-21 19:49:36 +04:00
SET ( KWSYS_USE_System 1 )
2003-06-20 02:57:11 +04:00
SET ( KWSYS_USE_SystemTools 1 )
2004-09-14 00:15:02 +04:00
SET ( KWSYS_USE_CommandLineArguments 1 )
2005-07-26 19:37:30 +04:00
SET ( KWSYS_USE_FundamentalType 1 )
2006-04-24 20:15:09 +04:00
SET ( KWSYS_USE_Terminal 1 )
2006-08-27 21:17:23 +04:00
SET ( KWSYS_USE_IOStream 1 )
2007-12-11 19:36:57 +03:00
SET ( KWSYS_USE_String 1 )
2008-01-30 19:17:36 +03:00
SET ( KWSYS_USE_SystemInformation 1 )
2008-02-28 00:07:14 +03:00
SET ( KWSYS_USE_CPU 1 )
2005-04-13 21:57:24 +04:00
ENDIF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
2008-10-17 20:51:57 +04:00
# 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 )
2008-10-17 20:52:03 +04:00
IF ( KWSYS_USE_SystemInformation )
SET ( KWSYS_USE_Process 1 )
ENDIF ( KWSYS_USE_SystemInformation )
2008-10-17 20:51:57 +04:00
2007-02-21 21:33:19 +03:00
# 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 )
2004-01-19 17:30:09 +03:00
# Enable testing if building standalone.
IF ( KWSYS_STANDALONE )
2005-04-13 21:57:24 +04:00
INCLUDE ( Dart )
2004-01-17 20:47:11 +03:00
MARK_AS_ADVANCED ( BUILD_TESTING DART_ROOT TCL_TCLSH )
IF ( BUILD_TESTING )
ENABLE_TESTING ( )
ENDIF ( BUILD_TESTING )
2004-01-19 17:30:09 +03:00
ENDIF ( KWSYS_STANDALONE )
2003-06-11 18:21:31 +04:00
2006-08-26 00:00:10 +04:00
# Include helper macros.
2006-10-05 00:56:32 +04:00
INCLUDE ( ${ CMAKE_CURRENT_SOURCE_DIR } /kwsysPlatformTests.cmake )
2006-08-27 21:17:23 +04:00
INCLUDE ( CheckTypeSize )
2006-08-26 00:00:10 +04:00
2003-06-23 16:56:03 +04:00
# Do full dependency headers.
INCLUDE_REGULAR_EXPRESSION ( "^.*$" )
2011-03-01 23:34:10 +03:00
# 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 )
2007-01-26 22:26:44 +03:00
2011-03-01 23:34:10 +03: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 )
2006-07-05 18:06:31 +04:00
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
2011-03-01 23:34:10 +03:00
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 }
2006-07-05 18:06:31 +04:00
)
2011-03-01 23:34:10 +03:00
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
2006-07-05 18:06:31 +04:00
2011-03-01 23:34:10 +03: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 )
2006-07-05 18:06:31 +04:00
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
2011-03-01 23:34:10 +03:00
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 }
2006-07-05 18:06:31 +04:00
)
2011-03-01 23:34:10 +03:00
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 )
2006-07-05 18:06:31 +04:00
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
2011-03-01 23:34:10 +03:00
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 }
2006-07-05 18:06:31 +04:00
)
2011-03-01 23:34:10 +03:00
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
ENDIF ( KWSYS_INSTALL_BIN_DIR )
2006-07-05 18:06:31 +04:00
2011-03-01 23:34:10 +03:00
# Do not support old KWSYS_*a_INSTALL_DIR variable names.
SET ( KWSYS_HEADER_INSTALL_DIR )
SET ( KWSYS_LIBRARY_INSTALL_DIR )
2006-07-05 18:06:31 +04:00
2003-07-10 22:46:48 +04:00
# Generated source files will need this header.
STRING ( COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
K W S Y S _ I N _ S O U R C E _ B U I L D )
IF ( NOT KWSYS_IN_SOURCE_BUILD )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsysPrivate.h
$ { P R O J E C T _ B I N A R Y _ D I R } / k w s y s P r i v a t e . h C O P Y _ O N L Y I M M E D I A T E )
ENDIF ( NOT KWSYS_IN_SOURCE_BUILD )
2010-06-10 17:26:32 +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 ( )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# We require ANSI support from the C compiler. Add any needed flags.
IF ( CMAKE_ANSI_CFLAGS )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}" )
ENDIF ( CMAKE_ANSI_CFLAGS )
2003-06-11 18:21:31 +04:00
2004-04-30 01:44:52 +04:00
#-----------------------------------------------------------------------------
# Adjust compiler flags for some platforms.
IF ( NOT CMAKE_COMPILER_IS_GNUCXX )
IF ( CMAKE_SYSTEM MATCHES "OSF1-V.*" )
STRING ( REGEX MATCH "-timplicit_local"
K W S Y S _ C X X _ F L A G S _ H A V E _ I M P L I C I T _ L O C A L " $ { C M A K E _ C X X _ F L A G S } " )
STRING ( REGEX MATCH "-no_implicit_include"
K W S Y S _ C X X _ F L A G S _ H A V E _ N O _ I M P L I C I T _ I N C L U D E " $ { C M A K E _ C X X _ F L A G S } " )
IF ( NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local" )
ENDIF ( NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL )
IF ( NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include" )
ENDIF ( NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE )
ENDIF ( CMAKE_SYSTEM MATCHES "OSF1-V.*" )
2006-08-30 21:59:56 +04:00
IF ( CMAKE_SYSTEM MATCHES "HP-UX" )
SET ( KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p" )
ENDIF ( CMAKE_SYSTEM MATCHES "HP-UX" )
2004-04-30 01:44:52 +04:00
ENDIF ( NOT CMAKE_COMPILER_IS_GNUCXX )
2006-08-26 00:00:10 +04:00
#-----------------------------------------------------------------------------
# Configure Large File Support.
2009-07-28 00:45:15 +04:00
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 )
2006-08-26 00:00:10 +04:00
SET ( KWSYS_LFS_AVAILABLE 0 )
IF ( KWSYS_LFS_REQUESTED )
# Large File Support is requested.
SET ( KWSYS_LFS_REQUESTED 1 )
# Check for large file support.
2009-07-28 00:45:15 +04:00
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 } )
2006-08-26 00:00:10 +04:00
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 )
2009-07-28 00:45:15 +04:00
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
2006-08-26 00:00:10 +04:00
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 )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's
2003-12-23 19:03:33 +03:00
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAVE_STD
" C h e c k i n g w h e t h e r S T L c l a s s e s a r e i n s t d n a m e s p a c e " D I R E C T )
IF ( KWSYS_IOS_FORCE_OLD )
2003-12-31 01:15:51 +03:00
SET ( KWSYS_IOS_USE_ANSI 0 )
2003-12-23 19:03:33 +03:00
ELSE ( KWSYS_IOS_FORCE_OLD )
2003-12-31 01:15:51 +03:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_ANSI
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r A N S I s t r e a m h e a d e r s a r e a v a i l a b l e " D I R E C T )
ENDIF ( KWSYS_IOS_FORCE_OLD )
2003-12-31 01:15:51 +03:00
IF ( KWSYS_IOS_USE_ANSI )
2003-12-23 19:03:33 +03:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_HAVE_STD
" C h e c k i n g w h e t h e r A N S I s t r e a m s a r e i n s t d n a m e s p a c e " D I R E C T )
2003-12-31 01:15:51 +03:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_SSTREAM
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r A N S I s t r i n g s t r e a m i s a v a i l a b l e " D I R E C T )
2003-12-31 01:15:51 +03:00
ELSE ( KWSYS_IOS_USE_ANSI )
2003-12-23 19:03:33 +03:00
SET ( KWSYS_IOS_HAVE_STD 0 )
2003-12-31 01:15:51 +03:00
SET ( KWSYS_IOS_USE_SSTREAM 0 )
ENDIF ( KWSYS_IOS_USE_ANSI )
IF ( KWSYS_IOS_USE_SSTREAM )
SET ( KWSYS_IOS_USE_STRSTREAM_H 0 )
SET ( KWSYS_IOS_USE_STRSTREA_H 0 )
ELSE ( KWSYS_IOS_USE_SSTREAM )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_STRSTREAM_H
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r s t r s t r e a m . h i s a v a i l a b l e " D I R E C T )
2003-12-31 01:15:51 +03:00
IF ( KWSYS_IOS_USE_STRSTREAM_H )
SET ( KWSYS_IOS_USE_STRSTREA_H 0 )
ELSE ( KWSYS_IOS_USE_STRSTREAM_H )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_IOS_USE_STRSTREA_H
2003-12-23 19:03:33 +03:00
" C h e c k i n g w h e t h e r s t r s t r e a . h i s a v a i l a b l e " D I R E C T )
2003-12-31 01:15:51 +03:00
ENDIF ( KWSYS_IOS_USE_STRSTREAM_H )
ENDIF ( KWSYS_IOS_USE_SSTREAM )
2003-05-12 21:43:03 +04:00
2005-04-16 00:00:44 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_CSTDDEF
" C h e c k i n g w h e t h e r h e a d e r c s t d d e f i s a v a i l a b l e " D I R E C T )
2005-03-31 00:27:16 +04:00
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES
- D K W S Y S _ S T L _ H A V E _ S T D = $ { K W S Y S _ S T L _ H A V E _ S T D } )
2005-03-29 19:10:25 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_STRING_HAVE_NEQ_CHAR
" C h e c k i n g w h e t h e r s t l s t r i n g h a s o p e r a t o r ! = f o r c h a r * " D I R E C T )
2005-04-15 17:54:03 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ITERATOR_TRAITS
" C h e c k i n g w h e t h e r s t l h a s i t e r a t o r _ t r a i t s " D I R E C T )
IF ( KWSYS_STL_HAS_ITERATOR_TRAITS )
SET ( KWSYS_STL_HAS_ITERATOR_CATEGORY 0 )
SET ( KWSYS_STL_HAS___ITERATOR_CATEGORY 0 )
ELSE ( KWSYS_STL_HAS_ITERATOR_TRAITS )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ITERATOR_CATEGORY
" C h e c k i n g w h e t h e r s t l h a s o l d i t e r a t o r _ c a t e g o r y " D I R E C T )
IF ( KWSYS_STL_HAS_ITERATOR_CATEGORY )
SET ( KWSYS_STL_HAS___ITERATOR_CATEGORY 0 )
ELSE ( KWSYS_STL_HAS_ITERATOR_CATEGORY )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS___ITERATOR_CATEGORY
" C h e c k i n g w h e t h e r s t l h a s i n t e r n a l _ _ i t e r a t o r _ c a t e g o r y " D I R E C T )
ENDIF ( KWSYS_STL_HAS_ITERATOR_CATEGORY )
ENDIF ( KWSYS_STL_HAS_ITERATOR_TRAITS )
2005-04-21 21:47:43 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
" C h e c k i n g w h e t h e r s t l h a s s t a n d a r d t e m p l a t e a l l o c a t o r " D I R E C T )
IF ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE )
SET ( KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE 0 )
2005-04-15 17:54:03 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_REBIND
" C h e c k i n g f o r r e b i n d m e m b e r o f s t l a l l o c a t o r " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
" C h e c k i n g f o r n o n - s t a n d a r d a r g u m e n t t o s t l a l l o c a t o r < > : : m a x _ s i z e " D I R E C T )
2005-04-21 21:47:43 +04:00
ELSE ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
" C h e c k i n g w h e t h e r s t l h a s o l d n o n - t e m p l a t e a l l o c a t o r " D I R E C T )
SET ( KWSYS_STL_HAS_ALLOCATOR_REBIND 0 )
SET ( KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT 0 )
ENDIF ( KWSYS_STL_HAS_ALLOCATOR_TEMPLATE )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STL_HAS_ALLOCATOR_OBJECTS
" C h e c k i n g w h e t h e r s t l c o n t a i n e r s s u p p o r t a l l o c a t o r o b j e c t s . " D I R E C T )
2007-04-19 19:21:35 +04:00
IF ( KWSYS_IOS_USE_ANSI AND NOT WATCOM )
2005-03-29 17:20:08 +04:00
# ANSI streams always have string operators.
SET ( KWSYS_STL_STRING_HAVE_OSTREAM 1 )
SET ( KWSYS_STL_STRING_HAVE_ISTREAM 1 )
2007-04-19 19:21:35 +04:00
ELSE ( KWSYS_IOS_USE_ANSI AND NOT WATCOM )
2005-03-29 17:20:08 +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 )
2007-04-19 19:21:35 +04:00
ENDIF ( KWSYS_IOS_USE_ANSI AND NOT WATCOM )
2009-08-31 21:00:55 +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 )
2005-03-31 00:27:16 +04:00
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
2005-03-29 17:20:08 +04:00
2005-04-13 16:08:54 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
" C h e c k i n g w h e t h e r \ " < > \ " i s n e e d e d f o r t e m p l a t e f r i e n d s " I N V E R T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_MEMBER_TEMPLATES
" C h e c k i n g f o r m e m b e r t e m p l a t e s u p p o r t " D I R E C T )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_FULL_SPECIALIZATION
" C h e c k i n g f o r s t a n d a r d t e m p l a t e s p e c i a l i z a t i o n s y n t a x " D I R E C T )
2005-04-15 16:59:30 +04:00
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
" C h e c k i n g w h e t h e r a r g u m e n t d e p e n d e n t l o o k u p i s s u p p o r t e d " D I R E C T )
2005-04-13 16:08:54 +04:00
2005-02-17 18:49:16 +03:00
IF ( UNIX )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_STAT_HAS_ST_MTIM
" C h e c k i n g w h e t h e r s t r u c t s t a t h a s s t _ m t i m m e m b e r " D I R E C T )
ENDIF ( UNIX )
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 ( )
2005-07-26 19:37:30 +04:00
IF ( KWSYS_USE_FundamentalType )
2009-11-20 16:38:18 +03:00
# 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 ( )
2005-07-26 19:37:30 +04:00
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 )
BUG: Reverting fundamental type info change until it is fixed on more platforms. It was tested on Linux, SGI, HP, Sun, OSX, Windows with nmake and VS 6, 7, 7.1, 8, Borland Make, and cygwin by hand with spaces in the path and cmake 2.0 and 2.2 before committing but still seems to be failing on some dashboards...strange.
2005-10-05 21:11:34 +04:00
# Check signedness of "char" type.
2006-08-25 23:53:03 +04:00
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 )
2005-07-26 19:37:30 +04:00
ENDIF ( KWSYS_USE_FundamentalType )
2006-08-27 21:17:23 +04:00
IF ( KWSYS_USE_IOStream )
# Determine whether iostreams support long long.
2012-11-01 00:44:00 +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 } )
2009-11-20 16:37:33 +03:00
IF ( KWSYS_CXX_HAS_LONG_LONG )
2006-08-27 21:17:23 +04:00
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 )
2009-11-20 16:37:33 +03:00
ELSE ( )
2006-08-27 21:17:23 +04:00
SET ( KWSYS_IOS_HAS_ISTREAM_LONG_LONG 0 )
SET ( KWSYS_IOS_HAS_OSTREAM_LONG_LONG 0 )
2009-11-20 16:37:33 +03:00
ENDIF ( )
2012-11-01 00:44:00 +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 )
2006-08-27 21:17:23 +04:00
ENDIF ( KWSYS_USE_IOStream )
2003-06-20 02:57:11 +04:00
IF ( KWSYS_NAMESPACE MATCHES "^kwsys$" )
SET ( KWSYS_NAME_IS_KWSYS 1 )
ELSE ( KWSYS_NAMESPACE MATCHES "^kwsys$" )
SET ( KWSYS_NAME_IS_KWSYS 0 )
ENDIF ( KWSYS_NAMESPACE MATCHES "^kwsys$" )
2003-06-30 18:30:38 +04:00
# Choose default shared/static build if not specified.
IF ( KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$" )
SET ( KWSYS_BUILD_SHARED ${ BUILD_SHARED_LIBS } )
ENDIF ( KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$" )
IF ( KWSYS_BUILD_SHARED )
SET ( KWSYS_BUILD_SHARED 1 )
SET ( KWSYS_LIBRARY_TYPE SHARED )
ELSE ( KWSYS_BUILD_SHARED )
SET ( KWSYS_BUILD_SHARED 0 )
SET ( KWSYS_LIBRARY_TYPE STATIC )
ENDIF ( KWSYS_BUILD_SHARED )
2010-06-29 16:44:33 +04:00
#-----------------------------------------------------------------------------
# Configure some implementation details.
2010-06-29 16:45:33 +04:00
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 } "
)
2012-04-26 18:36:53 +04:00
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 )
2010-06-29 16:44:33 +04:00
SET_SOURCE_FILES_PROPERTIES ( SystemTools.cxx PROPERTIES
2012-04-26 18:36:53 +04:00
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 ( )
2010-06-29 16:44:33 +04:00
2012-05-02 16:46:10 +04:00
IF ( KWSYS_USE_SystemInformation )
2012-10-01 23:18:30 +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 ( )
2012-11-01 00:44:00 +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 ( )
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 ( )
2012-05-02 16:46:10 +04:00
ENDIF ( )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Choose a directory for the generated headers.
2003-06-20 22:10:28 +04:00
IF ( NOT KWSYS_HEADER_ROOT )
SET ( KWSYS_HEADER_ROOT "${PROJECT_BINARY_DIR}" )
ENDIF ( NOT KWSYS_HEADER_ROOT )
SET ( KWSYS_HEADER_DIR "${KWSYS_HEADER_ROOT}/${KWSYS_NAMESPACE}" )
2004-03-15 22:54:26 +03:00
INCLUDE_DIRECTORIES ( ${ KWSYS_HEADER_ROOT } )
2003-06-20 02:57:11 +04:00
2009-09-28 19:36:54 +04:00
#-----------------------------------------------------------------------------
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 )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Create STL header wrappers to block warnings in the STL headers and
# give standard names by which they may be included.
2005-03-29 17:20:08 +04:00
SET ( KWSYS_STL_HEADER_EXTRA_string 1 )
2006-10-06 19:13:02 +04:00
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
)
2003-06-20 02:57:11 +04:00
# Configure the header wrapper.
SET ( KWSYS_STL_HEADER "${header}" )
2005-03-29 17:20:08 +04:00
IF ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
SET ( KWSYS_STL_HEADER_EXTRA
" #define ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n# include <${KWSYS_NAMESPACE}/stl/${header}.hxx>\n#undef ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n")
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_stl_ ${ header } .hxx.in
$ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r } . h x x
@ O N L Y I M M E D I A T E )
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } /stl/ ${ header } .hxx
2007-01-26 22:26:44 +03:00
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 } )
2006-07-05 18:06:31 +04:00
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
2005-03-29 17:20:08 +04:00
ELSE ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
SET ( KWSYS_STL_HEADER_EXTRA "" )
ENDIF ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_stl.hxx.in
2003-12-23 19:03:33 +03:00
$ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r }
2003-06-20 02:57:11 +04:00
@ O N L Y I M M E D I A T E )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Create an install target for the header wrapper.
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } /stl/ ${ header }
2007-01-26 22:26:44 +03:00
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 } )
2006-07-05 18:06:31 +04:00
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
2003-06-20 02:57:11 +04:00
ENDFOREACH ( header )
2005-04-16 00:00:44 +04:00
# Provide cstddef header.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_cstddef.hxx.in
$ { K W S Y S _ H E A D E R _ D I R } / c s t d d e f
@ O N L Y I M M E D I A T E )
2008-01-31 20:56:18 +03:00
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 )
2005-04-16 00:00:44 +04:00
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Create streams header wrappers to give standard names by which they
# may be included.
FOREACH ( header iostream fstream sstream iosfwd )
# Configure the header wrapper.
2003-12-23 19:03:33 +03:00
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_ios_ ${ header } .h.in
$ { K W S Y S _ H E A D E R _ D I R } / i o s / $ { h e a d e r }
2003-06-20 02:57:11 +04:00
@ O N L Y I M M E D I A T E )
# Create an install target for the header wrapper.
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } /ios/ ${ header }
2007-01-26 22:26:44 +03:00
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 } )
2006-07-05 18:06:31 +04:00
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
2003-06-20 02:57:11 +04:00
ENDFOREACH ( header )
#-----------------------------------------------------------------------------
# Build a list of classes and headers we need to implement the
# selected components. Initialize with required components.
SET ( KWSYS_CLASSES )
2005-03-25 16:41:57 +03:00
SET ( KWSYS_H_FILES Configure SharedForward )
2006-03-17 00:04:05 +03:00
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
)
2003-06-20 02:57:11 +04:00
# Add selected C++ classes.
2006-08-27 21:17:23 +04:00
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
2012-12-19 17:09:36 +04:00
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
2006-08-27 21:17:23 +04:00
)
2006-03-09 22:41:21 +03:00
FOREACH ( cpp ${ cppclasses } )
IF ( KWSYS_USE_ ${ cpp } )
2007-11-13 01:34:14 +03:00
# Use the corresponding class.
2006-03-09 22:41:21 +03:00
SET ( KWSYS_CLASSES ${ KWSYS_CLASSES } ${ cpp } )
2007-11-13 01:34:14 +03:00
# Load component-specific CMake code.
2007-11-13 01:38:15 +03:00
IF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ cpp } .cmake )
2007-11-13 01:34:14 +03:00
INCLUDE ( ${ PROJECT_SOURCE_DIR } /kwsys ${ cpp } .cmake )
2007-11-13 01:38:15 +03:00
ENDIF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ cpp } .cmake )
2006-03-09 22:41:21 +03:00
ENDIF ( KWSYS_USE_ ${ cpp } )
ENDFOREACH ( cpp )
2003-06-20 02:57:11 +04:00
# Add selected C components.
2008-02-28 00:07:14 +03:00
FOREACH ( c
2012-04-23 23:18:34 +04:00
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
2008-02-28 00:07:14 +03:00
)
2003-06-30 16:48:31 +04:00
IF ( KWSYS_USE_ ${ c } )
2007-11-13 01:34:14 +03:00
# Use the corresponding header file.
2003-06-30 16:48:31 +04:00
SET ( KWSYS_H_FILES ${ KWSYS_H_FILES } ${ c } )
2007-11-13 01:34:14 +03:00
# Load component-specific CMake code.
2007-11-13 01:38:15 +03:00
IF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ c } .cmake )
2007-11-13 01:34:14 +03:00
INCLUDE ( ${ PROJECT_SOURCE_DIR } /kwsys ${ c } .cmake )
2007-11-13 01:38:15 +03:00
ENDIF ( EXISTS ${ PROJECT_SOURCE_DIR } /kwsys ${ c } .cmake )
2003-06-30 16:48:31 +04:00
ENDIF ( KWSYS_USE_ ${ c } )
ENDFOREACH ( c )
2003-06-11 00:56:13 +04:00
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Build a list of sources for the library based on components that are
# included.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS )
SET ( KWSYS_CXX_SRCS )
2003-06-20 02:57:11 +04:00
# Add the proper sources for this platform's Process implementation.
IF ( KWSYS_USE_Process )
2005-04-16 00:10:26 +04:00
IF ( NOT UNIX )
2012-12-19 17:09:36 +04:00
# Use the Windows implementation.
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessWin32.c )
2005-04-16 00:10:26 +04:00
ELSE ( NOT UNIX )
2003-06-20 02:57:11 +04:00
# Use the UNIX implementation.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessUNIX.c )
2005-04-16 00:10:26 +04:00
ENDIF ( NOT UNIX )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_USE_Process )
2006-04-23 04:20:12 +04:00
# Add selected C sources.
2007-12-11 19:36:57 +03:00
FOREACH ( c Base64 MD5 Terminal System String )
2006-04-23 04:20:12 +04:00
IF ( KWSYS_USE_ ${ c } )
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ${ c } .c )
ENDIF ( KWSYS_USE_ ${ c } )
ENDFOREACH ( c )
2003-06-30 05:42:48 +04:00
2003-06-20 02:57:11 +04:00
# Configure headers of C++ classes and construct the list of sources.
FOREACH ( c ${ KWSYS_CLASSES } )
# Add this source to the list of source files for the library.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_CXX_SRCS ${ KWSYS_CXX_SRCS } ${ c } .cxx )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Configure the header for this class.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ c } .hxx.in ${ KWSYS_HEADER_DIR } / ${ c } .hxx
2003-04-08 21:10:44 +04:00
@ O N L Y I M M E D I A T E )
2009-02-13 23:49:47 +03:00
SET ( KWSYS_CXX_SRCS ${ KWSYS_CXX_SRCS } ${ KWSYS_HEADER_DIR } / ${ c } .hxx )
2003-06-20 02:57:11 +04:00
# Create an install target for the header.
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } / ${ c } .hxx
2007-01-26 22:26:44 +03:00
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 } )
2006-07-05 18:06:31 +04:00
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
2003-04-08 21:10:44 +04:00
ENDFOREACH ( c )
2003-06-20 02:57:11 +04:00
# Configure C headers.
FOREACH ( h ${ KWSYS_H_FILES } )
# Configure the header into the given directory.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ h } .h.in ${ KWSYS_HEADER_DIR } / ${ h } .h
2003-06-10 23:46:31 +04:00
@ O N L Y I M M E D I A T E )
2009-02-13 23:49:47 +03:00
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ${ KWSYS_HEADER_DIR } / ${ h } .h )
2003-06-20 02:57:11 +04:00
# Create an install target for the header.
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } / ${ h } .h
2007-01-26 22:26:44 +03:00
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 } )
2006-07-05 18:06:31 +04:00
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
2003-06-10 23:46:31 +04:00
ENDFOREACH ( h )
2003-06-20 02:57:11 +04:00
# Configure other C++ headers.
FOREACH ( h ${ KWSYS_HXX_FILES } )
# Configure the header into the given directory.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ h } .hxx.in ${ KWSYS_HEADER_DIR } / ${ h } .hxx
2003-04-08 21:10:44 +04:00
@ O N L Y I M M E D I A T E )
2009-02-13 23:49:47 +03:00
SET ( KWSYS_CXX_SRCS ${ KWSYS_CXX_SRCS } ${ KWSYS_HEADER_DIR } / ${ h } .hxx )
2003-04-08 21:10:44 +04:00
2003-06-20 02:57:11 +04:00
# Create an install target for the header.
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_INCLUDE_DIR )
INSTALL ( FILES ${ KWSYS_HEADER_DIR } / ${ h } .hxx
2007-01-26 22:26:44 +03:00
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 } )
2006-07-05 18:06:31 +04:00
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
2003-06-20 02:57:11 +04:00
ENDFOREACH ( h )
2003-04-08 21:10:44 +04:00
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Add the library with the configured name and list of sources.
2004-07-03 01:39:47 +04:00
IF ( KWSYS_C_SRCS OR KWSYS_CXX_SRCS )
ADD_LIBRARY ( ${ KWSYS_NAMESPACE } ${ KWSYS_LIBRARY_TYPE }
$ { K W S Y S _ C _ S R C S } $ { K W S Y S _ C X X _ S R C S } )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } PROPERTY LABELS ${ KWSYS_LABELS_LIB } )
2006-04-17 22:13:39 +04:00
IF ( KWSYS_USE_DynamicLoader )
IF ( UNIX )
2006-12-09 19:25:25 +03:00
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ${ CMAKE_DL_LIBS } )
2006-04-17 22:13:39 +04:00
ENDIF ( UNIX )
ENDIF ( KWSYS_USE_DynamicLoader )
2012-10-01 23:18:30 +04:00
2008-01-08 19:38:28 +03:00
IF ( KWSYS_USE_SystemInformation AND WIN32 )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ws2_32 )
2012-10-01 23:18:30 +04:00
IF ( KWSYS_SYS_HAS_PSAPI )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } Psapi )
ENDIF ( )
2008-01-08 19:38:28 +03:00
ENDIF ( KWSYS_USE_SystemInformation AND WIN32 )
2004-06-04 22:59:05 +04:00
2005-08-05 01:12:22 +04:00
# Apply user-defined target properties to the library.
IF ( KWSYS_PROPERTIES_CXX )
SET_TARGET_PROPERTIES ( ${ KWSYS_NAMESPACE } PROPERTIES
$ { K W S Y S _ P R O P E R T I E S _ C X X }
)
ENDIF ( KWSYS_PROPERTIES_CXX )
2004-06-04 22:59:05 +04:00
# Create an install target for the library.
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_LIBRARY_RULE )
INSTALL ( TARGETS ${ KWSYS_NAMESPACE } ${ KWSYS_INSTALL_LIBRARY_RULE } )
ENDIF ( KWSYS_INSTALL_LIBRARY_RULE )
2004-07-03 01:39:47 +04:00
ENDIF ( KWSYS_C_SRCS OR KWSYS_CXX_SRCS )
# Add a C-only library if requested.
IF ( KWSYS_ENABLE_C AND KWSYS_C_SRCS )
ADD_LIBRARY ( ${ KWSYS_NAMESPACE } _c ${ KWSYS_LIBRARY_TYPE } ${ KWSYS_C_SRCS } )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } _c PROPERTY LABELS ${ KWSYS_LABELS_LIB } )
2004-07-03 01:39:47 +04:00
2005-08-05 01:12:22 +04:00
# Apply user-defined target properties to the library.
IF ( KWSYS_PROPERTIES_C )
SET_TARGET_PROPERTIES ( ${ KWSYS_NAMESPACE } PROPERTIES
$ { K W S Y S _ P R O P E R T I E S _ C }
)
ENDIF ( KWSYS_PROPERTIES_C )
2004-07-03 01:39:47 +04:00
# Create an install target for the library.
2006-07-05 18:06:31 +04:00
IF ( KWSYS_INSTALL_LIBRARY_RULE )
INSTALL ( TARGETS ${ KWSYS_NAMESPACE } _c ${ KWSYS_INSTALL_LIBRARY_RULE } )
ENDIF ( KWSYS_INSTALL_LIBRARY_RULE )
2004-07-03 01:39:47 +04:00
ENDIF ( KWSYS_ENABLE_C AND KWSYS_C_SRCS )
2003-04-08 21:10:44 +04:00
2003-06-20 02:57:11 +04:00
# For building kwsys itself, we use a macro defined on the command
2003-07-10 22:32:30 +04:00
# line to configure the namespace in the C and C++ source files.
2003-06-20 02:57:11 +04:00
ADD_DEFINITIONS ( "-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}" )
2003-05-08 22:17:26 +04:00
2012-10-01 23:18:30 +04:00
# 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 ( )
2009-06-10 19:46:06 +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 " )
ENDIF ( KWSYS_USE_String )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Setup testing if not being built as part of another project.
2005-04-13 21:57:24 +04:00
IF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
2004-01-17 20:47:11 +03:00
IF ( BUILD_TESTING )
2007-03-03 18:47:06 +03:00
# Compute the location of executables.
2006-01-04 16:32:35 +03:00
SET ( EXEC_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
IF ( EXECUTABLE_OUTPUT_PATH )
SET ( EXEC_DIR "${EXECUTABLE_OUTPUT_PATH}" )
ENDIF ( EXECUTABLE_OUTPUT_PATH )
2007-03-03 18:47:06 +03:00
# C tests
SET ( KWSYS_C_TESTS
2007-03-14 22:12:10 +03:00
t e s t E n c o d e
2007-03-03 18:47:06 +03:00
t e s t T e r m i n a l
)
2011-03-01 23:34:10 +03:00
IF ( KWSYS_STANDALONE )
2007-03-03 18:47:06 +03:00
SET ( KWSYS_C_TESTS ${ KWSYS_C_TESTS } testFail )
2011-03-01 23:34:10 +03:00
ENDIF ( )
2007-03-03 18:47:06 +03:00
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 } )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestsC PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
2007-03-03 18:47:06 +03:00
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 } } )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TEST kwsys. ${ test } PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
2007-03-03 18:47:06 +03:00
ENDFOREACH ( test )
# C++ tests
2007-04-19 20:11:56 +04:00
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 }
2007-03-03 18:47:06 +03:00
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
)
2008-01-08 19:43:07 +03:00
IF ( KWSYS_USE_SystemInformation )
SET ( KWSYS_CXX_TESTS ${ KWSYS_CXX_TESTS } testSystemInformation )
ENDIF ( KWSYS_USE_SystemInformation )
2007-03-03 18:47:06 +03: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 )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestDynload PROPERTY LABELS ${ KWSYS_LABELS_LIB } )
2009-12-15 22:15:27 +03:00
ADD_DEPENDENCIES ( ${ KWSYS_NAMESPACE } TestDynload ${ KWSYS_NAMESPACE } )
2007-03-03 18:47:06 +03:00
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 } )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestsCxx PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
2007-03-03 18:47:06 +03:00
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } TestsCxx ${ KWSYS_NAMESPACE } )
2005-10-07 01:16:07 +04:00
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 " )
2006-03-09 22:41:21 +03:00
SET ( TEST_SYSTEMTOOLS_SRC_FILE
2005-10-06 00:06:45 +04:00
" $ { 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 " )
2005-10-04 23:09:00 +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 } )
2005-06-07 17:57:05 +04:00
IF ( CTEST_TEST_KWSYS )
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/ExtraTest.cmake.in"
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / E x t r a T e s t . c m a k e " )
SET_DIRECTORY_PROPERTIES ( PROPERTIES TEST_INCLUDE_FILE "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake" )
ENDIF ( CTEST_TEST_KWSYS )
2007-03-03 18:47:06 +03:00
SET ( KWSYS_TEST_ARGS_testCommandLineArguments
2006-07-14 17:13:23 +04:00
- - 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
2007-03-03 18:47:06 +03:00
- B B t r u e
2006-07-14 17:13:23 +04:00
- B B f a l s e
- S S = k e n
- A
- C = t e s t
2007-03-03 18:47:06 +03:00
- - l o n g 2 h e l l o
)
SET ( KWSYS_TEST_ARGS_testCommandLineArguments1
2006-07-14 23:02:27 +04:00
- - 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
2007-03-03 18:47:06 +03:00
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 } } )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TEST kwsys. ${ test } PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
2007-03-03 18:47:06 +03:00
ENDFOREACH ( test )
# Process tests.
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } TestProcess testProcess.c )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestProcess PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
2007-03-03 18:47:06 +03:00
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 } )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TEST kwsys.testProcess- ${ n } PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
2010-06-30 19:28:37 +04:00
SET_TESTS_PROPERTIES ( kwsys.testProcess- ${ n } PROPERTIES TIMEOUT 120 )
2007-03-03 18:47:06 +03:00
ENDFOREACH ( n )
2009-11-23 23:31:29 +03:00
# 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 ( )
2008-09-26 16:24:31 +04:00
# 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 )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestSharedForward PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
2009-12-15 22:15:27 +03:00
ADD_DEPENDENCIES ( ${ KWSYS_NAMESPACE } TestSharedForward ${ KWSYS_NAMESPACE } _c )
2008-09-26 16:24:31 +04:00
ADD_TEST ( kwsys.testSharedForward ${ EXEC_DIR } / ${ KWSYS_NAMESPACE } TestSharedForward 1 )
2011-03-01 23:34:10 +03:00
SET_PROPERTY ( TEST kwsys.testSharedForward PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
2008-09-26 16:24:31 +04:00
2007-03-03 18:47:06 +03:00
# Configure some test properties.
2011-03-01 23:34:10 +03:00
IF ( KWSYS_STANDALONE )
2006-03-13 18:49:35 +03:00
# We expect test to fail
2005-09-16 17:21:05 +04:00
SET_TESTS_PROPERTIES ( kwsys.testFail PROPERTIES WILL_FAIL ON )
2005-09-17 17:53:09 +04:00
GET_TEST_PROPERTY ( kwsys.testFail WILL_FAIL wfv )
2006-10-13 17:30:33 +04:00
SET_TESTS_PROPERTIES ( kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value" )
2005-09-20 18:42:38 +04:00
MESSAGE ( STATUS "GET_TEST_PROPERTY returned: ${wfv}" )
2011-03-01 23:34:10 +03:00
ENDIF ( )
2010-06-30 19:28:56 +04:00
# Suppress known consistent failures on buggy systems.
IF ( KWSYS_TEST_BOGUS_FAILURES )
SET_TESTS_PROPERTIES ( ${ KWSYS_TEST_BOGUS_FAILURES } PROPERTIES WILL_FAIL ON )
ENDIF ( )
2004-01-17 20:47:11 +03:00
ENDIF ( BUILD_TESTING )
2005-04-13 21:57:24 +04:00
ENDIF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )