2003-06-20 02:57:11 +04:00
#=============================================================================
2009-10-02 01:21:28 +04:00
# KWSys - Kitware System Library
# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
2003-06-20 02:57:11 +04:00
#
2009-10-02 01:21:28 +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-10-02 01:21:28 +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)
#
#
# Optional settings to setup install rules work in one of two ways.
# The modern way utilizes the CMake 2.4 INSTALL command. Settings
# for this mode 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 '/'.
2009-10-02 01:21:28 +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.
#
# 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)
#
# The old way uses the original CMake INSTALL_* commands. Settings
# for this mode are as follows:
#
2003-06-20 02:57:11 +04:00
# KWSYS_LIBRARY_INSTALL_DIR = The installation target directories into
# KWSYS_HEADER_INSTALL_DIR which the libraries and headers from
# kwsys should be installed by a "make install".
# The values should be specified relative to
# the installation prefix and start with a '/'.
# Example:
#
# SET(KWSYS_LIBRARY_INSTALL_DIR /lib)
# SET(KWSYS_HEADER_INSTALL_DIR /include)
#
2006-07-05 18:06:31 +04:00
# The modern way will be used whenever the INSTALL command is
# available. If the settings are not available the old names will be
# used to construct them. The old way will be used whenever the
# INSTALL command is not available. If the settings are not available
# the new names will be used to construct them.
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.
2010-01-29 00:48:20 +03:00
CMAKE_MINIMUM_REQUIRED ( VERSION 2.4.5 FATAL_ERROR )
IF ( COMMAND CMAKE_POLICY )
CMAKE_POLICY ( SET CMP0003 NEW )
ENDIF ( COMMAND CMAKE_POLICY )
# Allow empty endif() and such with CMake 2.4.
SET ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1 )
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 } )
2009-02-13 23:49:52 +03:00
# Some properties we set only with CMake 2.6 and above.
IF ( COMMAND SET_PROPERTY )
MACRO ( KWSYS_SET_PROPERTY )
SET_PROPERTY ( ${ ARGV } )
ENDMACRO ( KWSYS_SET_PROPERTY )
ELSE ( COMMAND SET_PROPERTY )
MACRO ( KWSYS_SET_PROPERTY )
ENDMACRO ( KWSYS_SET_PROPERTY )
ENDIF ( COMMAND SET_PROPERTY )
2008-05-14 19:55:41 +04:00
# Tell CMake how to follow dependencies of sources in this directory.
IF ( COMMAND SET_PROPERTY )
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 } / % > "
)
ENDIF ( COMMAND SET_PROPERTY )
2009-09-22 23:58:13 +04:00
# add option to disable memory cleanup at exit of putenv memory
IF ( DEFINED KWSYS_DO_NOT_CLEAN_PUTENV )
SET ( KWSYS_DO_NOT_CLEAN_PUTENV 1 )
ELSE ( DEFINED KWSYS_DO_NOT_CLEAN_PUTENV )
SET ( KWSYS_DO_NOT_CLEAN_PUTENV 0 )
ENDIF ( DEFINED KWSYS_DO_NOT_CLEAN_PUTENV )
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 )
2005-09-16 17:21:05 +04:00
SET ( KWSYS_USE_Registry 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-11-13 01:34:14 +03:00
SET ( KWSYS_USE_DateStamp 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_FundamentalType 1 )
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 ( "^.*$" )
2006-07-05 18:06:31 +04:00
# Choose which kind of install commands to use.
IF ( COMMAND INSTALL )
# 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 )
2007-01-26 22:26:44 +03: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 }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT )
2006-07-05 18:06:31 +04:00
# Setup library install rules.
SET ( KWSYS_INSTALL_LIBRARY_RULE )
IF ( KWSYS_INSTALL_LIB_DIR )
# Install the shared library to the lib directory.
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
L I B R A R Y D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ L I B _ D I R }
)
# Assign the shared library to the runtime component.
IF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ R U N T I M E }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
# Install the archive to the lib directory.
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
A R C H I V E D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ L I B _ D I R }
)
# Assign the archive to the development component.
IF ( KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT )
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ D E V E L O P M E N T }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT )
ENDIF ( KWSYS_INSTALL_LIB_DIR )
IF ( KWSYS_INSTALL_BIN_DIR )
# Install the runtime library to the bin directory.
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
R U N T I M E D E S T I N A T I O N $ { K W S Y S _ I N S T A L L _ B I N _ D I R }
)
# Assign the runtime library to the runtime component.
IF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
SET ( KWSYS_INSTALL_LIBRARY_RULE ${ KWSYS_INSTALL_LIBRARY_RULE }
C O M P O N E N T $ { K W S Y S _ I N S T A L L _ C O M P O N E N T _ N A M E _ R U N T I M E }
)
ENDIF ( KWSYS_INSTALL_COMPONENT_NAME_RUNTIME )
ENDIF ( KWSYS_INSTALL_BIN_DIR )
# Do not support old KWSYS_*_INSTALL_DIR variable names.
SET ( KWSYS_HEADER_INSTALL_DIR )
SET ( KWSYS_LIBRARY_INSTALL_DIR )
ELSE ( COMMAND INSTALL )
# Use old KWSYS_*_INSTALL_DIR variable names.
# Take defaults from the new names.
IF ( KWSYS_INSTALL_LIB_DIR )
IF ( NOT KWSYS_LIBRARY_INSTALL_DIR )
SET ( KWSYS_LIBRARY_INSTALL_DIR "/${KWSYS_INSTALL_LIB_DIR}" )
ENDIF ( NOT KWSYS_LIBRARY_INSTALL_DIR )
ENDIF ( KWSYS_INSTALL_LIB_DIR )
IF ( KWSYS_INSTALL_INCLUDE_DIR )
IF ( NOT KWSYS_HEADER_INSTALL_DIR )
SET ( KWSYS_HEADER_INSTALL_DIR "/${KWSYS_INSTALL_INCLUDE_DIR}" )
ENDIF ( NOT KWSYS_HEADER_INSTALL_DIR )
ENDIF ( KWSYS_INSTALL_INCLUDE_DIR )
# Do not support new KWSYS_INSTALL_*_DIR variable names.
SET ( KWSYS_INSTALL_BIN_DIR )
SET ( KWSYS_INSTALL_INCLUDE_DIR )
SET ( KWSYS_INSTALL_LIB_DIR )
ENDIF ( COMMAND INSTALL )
2003-07-10 22:46:48 +04:00
# Generated source files will need this header.
STRING ( COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
K W S Y S _ I N _ S O U R C E _ B U I L D )
IF ( NOT KWSYS_IN_SOURCE_BUILD )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsysPrivate.h
$ { P R O J E C T _ B I N A R Y _ D I R } / k w s y s P r i v a t e . h C O P Y _ O N L Y I M M E D I A T E )
ENDIF ( NOT KWSYS_IN_SOURCE_BUILD )
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# We require ANSI support from the C compiler. Add any needed flags.
IF ( CMAKE_ANSI_CFLAGS )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}" )
ENDIF ( CMAKE_ANSI_CFLAGS )
2003-06-11 18:21:31 +04:00
2004-04-30 01:44:52 +04:00
#-----------------------------------------------------------------------------
# Adjust compiler flags for some platforms.
IF ( NOT CMAKE_COMPILER_IS_GNUCXX )
IF ( CMAKE_SYSTEM MATCHES "OSF1-V.*" )
STRING ( REGEX MATCH "-timplicit_local"
K W S Y S _ C X X _ F L A G S _ H A V E _ I M P L I C I T _ L O C A L " $ { C M A K E _ C X X _ F L A G S } " )
STRING ( REGEX MATCH "-no_implicit_include"
K W S Y S _ C X X _ F L A G S _ H A V E _ N O _ I M P L I C I T _ I N C L U D E " $ { C M A K E _ C X X _ F L A G S } " )
IF ( NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local" )
ENDIF ( NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL )
IF ( NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include" )
ENDIF ( NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE )
ENDIF ( CMAKE_SYSTEM MATCHES "OSF1-V.*" )
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 )
2005-07-26 19:37:30 +04:00
IF ( KWSYS_USE_FundamentalType )
2010-01-29 00:48:20 +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
# Check uniqueness of types.
IF ( KWSYS_SIZEOF___INT64 )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_SAME_LONG_AND___INT64
" C h e c k i n g w h e t h e r l o n g a n d _ _ i n t 6 4 a r e t h e s a m e t y p e " D I R E C T )
IF ( KWSYS_SIZEOF_LONG_LONG )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CXX_SAME_LONG_LONG_AND___INT64
" C h e c k i n g w h e t h e r l o n g l o n g a n d _ _ i n t 6 4 a r e t h e s a m e t y p e " D I R E C T )
ENDIF ( KWSYS_SIZEOF_LONG_LONG )
ENDIF ( KWSYS_SIZEOF___INT64 )
# Enable the "long long" type if it is available. It is standard in
# C99 and C++03 but not in earlier standards.
IF ( KWSYS_SIZEOF_LONG_LONG )
SET ( KWSYS_USE_LONG_LONG 1 )
ELSE ( KWSYS_SIZEOF_LONG_LONG )
SET ( KWSYS_USE_LONG_LONG 0 )
ENDIF ( KWSYS_SIZEOF_LONG_LONG )
# Enable the "__int64" type if it is available and unique. It is not
# standard.
SET ( KWSYS_USE___INT64 0 )
IF ( KWSYS_SIZEOF___INT64 )
IF ( NOT KWSYS_CXX_SAME_LONG_AND___INT64 )
IF ( NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64 )
SET ( KWSYS_USE___INT64 1 )
ENDIF ( NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64 )
ENDIF ( NOT KWSYS_CXX_SAME_LONG_AND___INT64 )
ENDIF ( KWSYS_SIZEOF___INT64 )
IF ( KWSYS_USE___INT64 )
KWSYS_PLATFORM_CXX_TEST ( KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
" C h e c k i n g w h e t h e r u n s i g n e d _ _ i n t 6 4 c a n c o n v e r t t o d o u b l e " D I R E C T )
ELSE ( KWSYS_USE___INT64 )
SET ( KWSYS_CAN_CONVERT_UI64_TO_DOUBLE 1 )
ENDIF ( KWSYS_USE___INT64 )
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.
2010-01-29 00:48:20 +03:00
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 )
IF ( KWSYS_CXX_HAS_LONG_LONG )
2006-08-27 21:17: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 } )
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 )
SET ( KWSYS_PLATFORM_CXX_TEST_DEFINES )
2010-01-29 00:48:20 +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 )
2010-01-29 00:48:20 +03:00
ENDIF ( )
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 )
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-10-02 01:21:28 +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
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE } /stl
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r } . h x x )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ELSE ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
SET ( KWSYS_STL_HEADER_EXTRA "" )
ENDIF ( KWSYS_STL_HEADER_EXTRA_ ${ header } )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_stl.hxx.in
2003-12-23 19:03:33 +03:00
$ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r }
2003-06-20 02:57:11 +04:00
@ O N L Y I M M E D I A T E )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Create an install target for the header wrapper.
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
IF ( KWSYS_HEADER_INSTALL_DIR )
2003-12-23 19:03:33 +03:00
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE } /stl
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / s t l / $ { h e a d e r } )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ENDFOREACH ( header )
2005-04-16 00:00:44 +04:00
# Provide cstddef header.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /kwsys_cstddef.hxx.in
$ { K W S Y S _ H E A D E R _ D I R } / c s t d d e f
@ O N L Y I M M E D I A T E )
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 } )
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE }
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / c s t d d e f )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
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
IF ( KWSYS_HEADER_INSTALL_DIR )
2003-12-23 19:03:33 +03:00
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE } /ios
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / i o s / $ { h e a d e r } )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ENDFOREACH ( header )
#-----------------------------------------------------------------------------
# Build a list of classes and headers we need to implement the
# selected components. Initialize with required components.
SET ( KWSYS_CLASSES )
2005-03-25 16:41:57 +03:00
SET ( KWSYS_H_FILES Configure SharedForward )
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
2008-01-08 19:38:28 +03:00
C o m m a n d L i n e A r g u m e n t s R e g i s t r y 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
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 D a t e S t a m p S t r i n g C P U
)
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 )
2003-06-20 02:57:11 +04:00
# Use the Windows implementation. We need the encoded forwarding executable.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessWin32.c
2003-07-10 22:46:48 +04:00
$ { P R O J E C T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c )
SET_SOURCE_FILES_PROPERTIES (
$ { P R O J E C T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
P R O P E R T I E S G E N E R A T E D 1 )
2005-04-16 00:10:26 +04:00
ELSE ( NOT UNIX )
2003-06-20 02:57:11 +04:00
# Use the UNIX implementation.
2004-07-03 01:39:47 +04:00
SET ( KWSYS_C_SRCS ${ KWSYS_C_SRCS } ProcessUNIX.c )
2006-10-05 01:27:17 +04:00
# Help ProcessUNIX.c compile properly on all platforms.
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 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 } "
)
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-06-20 02:57:11 +04:00
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE }
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / $ { c } . h x x )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
2003-04-08 21:10:44 +04:00
ENDFOREACH ( c )
2003-06-20 02:57:11 +04:00
# Configure C headers.
FOREACH ( h ${ KWSYS_H_FILES } )
# Configure the header into the given directory.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ h } .h.in ${ KWSYS_HEADER_DIR } / ${ h } .h
2003-06-10 23:46:31 +04:00
@ O N L Y I M M E D I A T E )
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-20 02:57:11 +04:00
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE }
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / $ { h } . h )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
2003-06-10 23:46:31 +04:00
ENDFOREACH ( h )
2003-06-20 02:57:11 +04:00
# Configure other C++ headers.
FOREACH ( h ${ KWSYS_HXX_FILES } )
# Configure the header into the given directory.
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } / ${ h } .hxx.in ${ KWSYS_HEADER_DIR } / ${ h } .hxx
2003-04-08 21:10:44 +04:00
@ O N L Y I M M E D I A T E )
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
IF ( KWSYS_HEADER_INSTALL_DIR )
INSTALL_FILES ( ${ KWSYS_HEADER_INSTALL_DIR } / ${ KWSYS_NAMESPACE }
F I L E S $ { K W S Y S _ H E A D E R _ D I R } / $ { h } . h x x )
ENDIF ( KWSYS_HEADER_INSTALL_DIR )
ENDFOREACH ( h )
2003-04-08 21:10:44 +04:00
2003-06-20 02:57:11 +04:00
#-----------------------------------------------------------------------------
# Add the library with the configured name and list of sources.
2004-07-03 01:39:47 +04:00
IF ( KWSYS_C_SRCS OR KWSYS_CXX_SRCS )
ADD_LIBRARY ( ${ KWSYS_NAMESPACE } ${ KWSYS_LIBRARY_TYPE }
$ { K W S Y S _ C _ S R C S } $ { K W S Y S _ C X X _ S R C S } )
2009-02-13 23:49:52 +03:00
KWSYS_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 )
2008-01-08 19:38:28 +03:00
IF ( KWSYS_USE_SystemInformation AND WIN32 )
TARGET_LINK_LIBRARIES ( ${ KWSYS_NAMESPACE } ws2_32 )
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-06-04 22:59:05 +04:00
IF ( KWSYS_LIBRARY_INSTALL_DIR )
2006-07-05 18:06:31 +04:00
INSTALL_TARGETS ( ${ KWSYS_LIBRARY_INSTALL_DIR } ${ KWSYS_NAMESPACE } )
2004-06-04 22:59:05 +04:00
ENDIF ( KWSYS_LIBRARY_INSTALL_DIR )
2004-07-03 01:39:47 +04:00
ENDIF ( KWSYS_C_SRCS OR KWSYS_CXX_SRCS )
# Add a C-only library if requested.
IF ( KWSYS_ENABLE_C AND KWSYS_C_SRCS )
ADD_LIBRARY ( ${ KWSYS_NAMESPACE } _c ${ KWSYS_LIBRARY_TYPE } ${ KWSYS_C_SRCS } )
2009-02-13 23:49:52 +03:00
KWSYS_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
IF ( KWSYS_LIBRARY_INSTALL_DIR )
INSTALL_TARGETS ( ${ KWSYS_LIBRARY_INSTALL_DIR } ${ KWSYS_NAMESPACE } _c )
ENDIF ( KWSYS_LIBRARY_INSTALL_DIR )
ENDIF ( KWSYS_ENABLE_C AND KWSYS_C_SRCS )
2003-04-08 21:10:44 +04:00
2003-06-20 02:57:11 +04:00
# For building kwsys itself, we use a macro defined on the command
2003-07-10 22:32:30 +04:00
# line to configure the namespace in the C and C++ source files.
2003-06-20 02:57:11 +04:00
ADD_DEFINITIONS ( "-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}" )
2003-05-08 22:17:26 +04:00
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-05-08 22:46:23 +04:00
#-----------------------------------------------------------------------------
2003-06-20 02:57:11 +04:00
# Process execution on windows needs to build a forwarding executable
# that works around a Win9x bug. We encode the executable into a C
# file and build it into the library. Win9x platforms reproduce the
# executable into a temporary directory when it is needed.
IF ( KWSYS_USE_Process )
2005-04-16 00:10:26 +04:00
IF ( NOT UNIX )
2003-06-20 02:57:11 +04:00
# Build the forwarding executable itself and a program that will
# encode it into a C file.
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } ProcessFwd9x ProcessFwd9x.c )
ADD_EXECUTABLE ( ${ KWSYS_NAMESPACE } EncodeExecutable EncodeExecutable.c )
2009-02-13 23:49:52 +03:00
KWSYS_SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } ProcessFwd9x PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
KWSYS_SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } EncodeExecutable PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
2003-05-08 22:46:23 +04:00
2003-06-20 02:57:11 +04:00
# Construct the location of the executable to be encoded.
SET ( BIN_DIR ${ CMAKE_CURRENT_BINARY_DIR } )
IF ( EXECUTABLE_OUTPUT_PATH )
SET ( BIN_DIR ${ EXECUTABLE_OUTPUT_PATH } )
ENDIF ( EXECUTABLE_OUTPUT_PATH )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
SET ( CFG_INTDIR "/${CMAKE_CFG_INTDIR}" )
IF ( CMAKE_BUILD_TOOL MATCHES "make" )
SET ( CFG_INTDIR "" )
ENDIF ( CMAKE_BUILD_TOOL MATCHES "make" )
2003-05-12 21:15:49 +04:00
2003-06-20 02:57:11 +04:00
# Take advantage of a better custom command syntax if possible.
SET ( CMD ${ BIN_DIR } ${ CFG_INTDIR } / ${ KWSYS_NAMESPACE } EncodeExecutable.exe )
SET ( FWD ${ BIN_DIR } ${ CFG_INTDIR } / ${ KWSYS_NAMESPACE } ProcessFwd9x.exe )
IF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6 )
ADD_CUSTOM_COMMAND (
O U T P U T $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
C O M M A N D $ { C M D }
A R G S $ { F W D } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
2004-05-06 23:34:04 +04:00
$ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x
2003-06-20 02:57:11 +04:00
D E P E N D S $ { C M D } $ { F W D } )
ELSE ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6 )
ADD_CUSTOM_COMMAND (
T A R G E T $ { K W S Y S _ N A M E S P A C E }
S O U R C E $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / P r o c e s s F w d 9 x . c
C O M M A N D $ { C M D }
A R G S $ { F W D } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
2004-05-06 23:34:04 +04:00
$ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x
2003-06-20 02:57:11 +04:00
O U T P U T S $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { K W S Y S _ N A M E S P A C E } P r o c e s s F w d 9 x E n c . c
D E P E N D S $ { C M D } $ { F W D } )
ENDIF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6 )
2003-12-08 19:35:34 +03:00
2003-06-20 02:57:11 +04:00
# Make sure build occurs in proper order.
ADD_DEPENDENCIES ( ${ KWSYS_NAMESPACE } ${ KWSYS_NAMESPACE } ProcessFwd9x
$ { K W S Y S _ N A M E S P A C E } E n c o d e E x e c u t a b l e )
2005-04-16 00:10:26 +04:00
ENDIF ( NOT UNIX )
2003-06-20 02:57:11 +04:00
ENDIF ( KWSYS_USE_Process )
#-----------------------------------------------------------------------------
# Setup testing if not being built as part of another project.
2005-04-13 21:57:24 +04:00
IF ( KWSYS_STANDALONE OR CMake_SOURCE_DIR )
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
)
IF ( COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE )
SET ( KWSYS_C_TESTS ${ KWSYS_C_TESTS } testFail )
ENDIF ( COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE )
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 } )
2009-02-13 23:49:52 +03:00
KWSYS_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 } } )
2009-02-13 23:49:52 +03:00
KWSYS_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 R e g i s t r y
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 )
2009-02-13 23:49:52 +03:00
KWSYS_SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestDynload PROPERTY LABELS ${ KWSYS_LABELS_LIB } )
2010-01-29 00:48:20 +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 } )
2009-02-13 23:49:52 +03:00
KWSYS_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 } } )
2009-02-13 23:49:52 +03:00
KWSYS_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 )
2009-02-13 23:49:52 +03:00
KWSYS_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 } )
2009-02-13 23:49:52 +03:00
KWSYS_SET_PROPERTY ( TEST kwsys.testProcess- ${ n } PROPERTY LABELS ${ KWSYS_LABELS_TEST } )
2007-03-03 18:47:06 +03:00
ENDFOREACH ( n )
2010-01-29 00:48:20 +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 )
2009-02-13 23:49:52 +03:00
KWSYS_SET_PROPERTY ( TARGET ${ KWSYS_NAMESPACE } TestSharedForward PROPERTY LABELS ${ KWSYS_LABELS_EXE } )
2010-01-29 00:48:20 +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 )
2009-02-13 23:49:52 +03:00
KWSYS_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.
2005-11-09 01:59:58 +03:00
IF ( COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND 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 )
2007-09-19 19:16:57 +04:00
SET_TESTS_PROPERTIES ( kwsys.testRegistry PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR_NOT_VALGRIND;FAIL;Test failed" )
2005-11-09 19:07:36 +03:00
SET_TESTS_PROPERTIES ( kwsys.testRegistry PROPERTIES PASS_REGULAR_EXPRESSION "Test passed" )
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}" )
2005-11-09 01:59:58 +03:00
ENDIF ( COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE )
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 )