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
|
|
|
#
|
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)
|
2013-10-02 22:45:54 +04:00
|
|
|
IF(POLICY CMP0025)
|
|
|
|
CMAKE_POLICY(SET CMP0025 NEW)
|
|
|
|
ENDIF()
|
2015-05-28 15:21:55 +03:00
|
|
|
IF(POLICY CMP0056)
|
|
|
|
CMAKE_POLICY(SET CMP0056 NEW)
|
|
|
|
ENDIF()
|
2015-08-31 16:55:01 +03:00
|
|
|
SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2005-04-13 21:57:24 +04:00
|
|
|
|
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
|
|
|
|
PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
|
|
|
|
"KWSYS_HEADER(%)=<${KWSYS_NAMESPACE}/%>"
|
|
|
|
)
|
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)
|
2013-11-25 20:19:42 +04:00
|
|
|
SET(KWSYS_USE_Encoding 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)
|
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)
|
2013-11-25 20:19:42 +04:00
|
|
|
SET(KWSYS_USE_FStream 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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2008-10-17 20:51:57 +04:00
|
|
|
|
|
|
|
# Enforce component dependencies.
|
|
|
|
IF(KWSYS_USE_SystemTools)
|
|
|
|
SET(KWSYS_USE_Directory 1)
|
2013-11-25 20:19:42 +04:00
|
|
|
SET(KWSYS_USE_FStream 1)
|
|
|
|
SET(KWSYS_USE_Encoding 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2008-10-17 20:51:57 +04:00
|
|
|
IF(KWSYS_USE_Glob)
|
|
|
|
SET(KWSYS_USE_Directory 1)
|
|
|
|
SET(KWSYS_USE_SystemTools 1)
|
|
|
|
SET(KWSYS_USE_RegularExpression 1)
|
2013-11-25 20:19:42 +04:00
|
|
|
SET(KWSYS_USE_FStream 1)
|
|
|
|
SET(KWSYS_USE_Encoding 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2008-10-17 20:51:57 +04:00
|
|
|
IF(KWSYS_USE_Process)
|
|
|
|
SET(KWSYS_USE_System 1)
|
2013-11-25 20:19:42 +04:00
|
|
|
SET(KWSYS_USE_Encoding 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2008-10-17 20:52:03 +04:00
|
|
|
IF(KWSYS_USE_SystemInformation)
|
|
|
|
SET(KWSYS_USE_Process 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(KWSYS_USE_System)
|
|
|
|
SET(KWSYS_USE_Encoding 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(KWSYS_USE_Directory)
|
|
|
|
SET(KWSYS_USE_Encoding 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(KWSYS_USE_FStream)
|
|
|
|
SET(KWSYS_USE_Encoding 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ELSE()
|
2007-02-21 21:33:19 +03:00
|
|
|
SET(KWSYS_LFS_REQUESTED 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2007-02-21 21:33:19 +03:00
|
|
|
|
2013-11-25 20:19:42 +04:00
|
|
|
# Specify default 8 bit encoding for Windows
|
|
|
|
IF(NOT KWSYS_ENCODING_DEFAULT_CODEPAGE)
|
|
|
|
SET(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_ACP)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2013-11-25 20:19:42 +04:00
|
|
|
|
2004-01-19 17:30:09 +03:00
|
|
|
# Enable testing if building standalone.
|
|
|
|
IF(KWSYS_STANDALONE)
|
2005-04-13 21:57:24 +04:00
|
|
|
INCLUDE(Dart)
|
2004-01-17 20:47:11 +03:00
|
|
|
MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
|
|
|
|
IF(BUILD_TESTING)
|
|
|
|
ENABLE_TESTING()
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
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
|
|
|
|
"${KWSYS_HEADER_INSTALL_DIR}")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2011-03-01 23:34:10 +03:00
|
|
|
IF(NOT KWSYS_INSTALL_LIB_DIR)
|
|
|
|
STRING(REGEX REPLACE "^/" "" KWSYS_INSTALL_LIB_DIR
|
|
|
|
"${KWSYS_LIBRARY_INSTALL_DIR}")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2011-03-01 23:34:10 +03:00
|
|
|
IF(NOT KWSYS_INSTALL_BIN_DIR)
|
|
|
|
STRING(REGEX REPLACE "^/" "" KWSYS_INSTALL_BIN_DIR
|
|
|
|
"${KWSYS_LIBRARY_INSTALL_DIR}")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2011-03-01 23:34:10 +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}
|
|
|
|
COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT}
|
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
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}
|
|
|
|
LIBRARY DESTINATION ${KWSYS_INSTALL_LIB_DIR}
|
|
|
|
)
|
|
|
|
# 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
|
|
|
COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_RUNTIME}
|
2006-07-05 18:06:31 +04:00
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
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}
|
|
|
|
ARCHIVE DESTINATION ${KWSYS_INSTALL_LIB_DIR}
|
|
|
|
)
|
|
|
|
# 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
|
|
|
COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT}
|
2006-07-05 18:06:31 +04:00
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-03-01 23:34:10 +03:00
|
|
|
IF(KWSYS_INSTALL_BIN_DIR)
|
|
|
|
# Install the runtime library to the bin directory.
|
|
|
|
SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
|
|
|
|
RUNTIME DESTINATION ${KWSYS_INSTALL_BIN_DIR}
|
|
|
|
)
|
|
|
|
# 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
|
|
|
COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_RUNTIME}
|
2006-07-05 18:06:31 +04:00
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
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}"
|
|
|
|
KWSYS_IN_SOURCE_BUILD)
|
|
|
|
IF(NOT KWSYS_IN_SOURCE_BUILD)
|
|
|
|
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsysPrivate.h
|
2014-10-31 20:11:58 +03:00
|
|
|
${PROJECT_BINARY_DIR}/kwsysPrivate.h COPYONLY IMMEDIATE)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2003-07-10 22:46:48 +04:00
|
|
|
|
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}")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
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"
|
|
|
|
KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL "${CMAKE_CXX_FLAGS}")
|
|
|
|
STRING(REGEX MATCH "-no_implicit_include"
|
|
|
|
KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE "${CMAKE_CXX_FLAGS}")
|
|
|
|
IF(NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2004-04-30 01:44:52 +04:00
|
|
|
IF(NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2006-08-30 21:59:56 +04:00
|
|
|
IF(CMAKE_SYSTEM MATCHES "HP-UX")
|
|
|
|
SET(KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p")
|
2014-04-08 21:06:14 +04:00
|
|
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "HP")
|
|
|
|
# it is known that version 3.85 fails and 6.25 works without these flags
|
|
|
|
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4)
|
|
|
|
# use new C++ library and improved template support
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2015-08-31 16:55:01 +03:00
|
|
|
IF(KWSYS_STANDALONE)
|
|
|
|
IF(CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
|
|
|
|
IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
|
|
|
|
ELSE()
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2004-04-30 01:44:52 +04:00
|
|
|
|
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
|
|
|
|
"Checking whether header cstdio is available" DIRECT)
|
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
|
|
|
|
-DKWSYS_CXX_HAS_CSTDIO=${KWSYS_CXX_HAS_CSTDIO})
|
2006-08-26 00:00:10 +04:00
|
|
|
KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_LFS_WORKS
|
|
|
|
"Checking for Large File Support" DIRECT)
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ELSE()
|
2006-08-26 00:00:10 +04:00
|
|
|
# Large File Support is not requested.
|
|
|
|
SET(KWSYS_LFS_REQUESTED 0)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2006-08-26 00:00:10 +04:00
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
"Checking whether C++ compiler has 'long long'" DIRECT)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS___INT64
|
|
|
|
"Checking whether C++ compiler has '__int64'" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS___INT64)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_AND___INT64
|
|
|
|
"Checking whether long and __int64 are the same type" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS_LONG_LONG)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_LONG_AND___INT64
|
|
|
|
"Checking whether long long and __int64 are the same type" DIRECT)
|
|
|
|
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()
|
|
|
|
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(KWSYS_USE_Encoding)
|
|
|
|
# Look for type size helper macros.
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING
|
|
|
|
"Checking whether wstring is available" DIRECT)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2013-11-25 20:19:42 +04:00
|
|
|
|
2006-08-27 21:17:23 +04:00
|
|
|
IF(KWSYS_USE_IOStream)
|
|
|
|
# Determine whether iostreams support long long.
|
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
|
|
|
|
"Checking if istream supports long long" DIRECT)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM_LONG_LONG
|
|
|
|
"Checking if ostream supports long long" DIRECT)
|
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
|
|
|
|
"Checking if istream supports __int64" DIRECT)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM___INT64
|
|
|
|
"Checking if ostream supports __int64" DIRECT)
|
|
|
|
ELSE()
|
|
|
|
SET(KWSYS_IOS_HAS_ISTREAM___INT64 0)
|
|
|
|
SET(KWSYS_IOS_HAS_OSTREAM___INT64 0)
|
|
|
|
ENDIF()
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2006-08-27 21:17:23 +04:00
|
|
|
|
2003-06-20 02:57:11 +04:00
|
|
|
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
|
|
|
|
SET(KWSYS_NAME_IS_KWSYS 1)
|
2014-11-12 16:58:42 +03:00
|
|
|
ELSE()
|
2003-06-20 02:57:11 +04:00
|
|
|
SET(KWSYS_NAME_IS_KWSYS 0)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2003-06-20 02:57:11 +04:00
|
|
|
|
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})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2003-06-30 18:30:38 +04:00
|
|
|
|
|
|
|
IF(KWSYS_BUILD_SHARED)
|
|
|
|
SET(KWSYS_BUILD_SHARED 1)
|
|
|
|
SET(KWSYS_LIBRARY_TYPE SHARED)
|
2014-11-12 16:58:42 +03:00
|
|
|
ELSE()
|
2003-06-30 18:30:38 +04:00
|
|
|
SET(KWSYS_BUILD_SHARED 0)
|
|
|
|
SET(KWSYS_LIBRARY_TYPE STATIC)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2003-06-30 18:30:38 +04:00
|
|
|
|
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
|
|
|
|
"Checking whether C compiler has ptrdiff_t in stddef.h" DIRECT)
|
|
|
|
KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_SSIZE_T
|
|
|
|
"Checking whether C compiler has ssize_t in unistd.h" DIRECT)
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(ProcessUNIX.c System.c PROPERTIES
|
|
|
|
COMPILE_FLAGS "-DKWSYS_C_HAS_PTRDIFF_T=${KWSYS_C_HAS_PTRDIFF_T} -DKWSYS_C_HAS_SSIZE_T=${KWSYS_C_HAS_SSIZE_T}"
|
|
|
|
)
|
|
|
|
|
2012-04-26 18:36:53 +04:00
|
|
|
IF(KWSYS_USE_SystemTools)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_SETENV
|
|
|
|
"Checking whether CXX compiler has setenv" DIRECT)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UNSETENV
|
|
|
|
"Checking whether CXX compiler has unsetenv" DIRECT)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
|
|
|
|
"Checking whether CXX compiler has environ in stdlib.h" DIRECT)
|
2013-06-03 18:23:31 +04:00
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UTIMES
|
|
|
|
"Checking whether CXX compiler has utimes" DIRECT)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UTIMENSAT
|
|
|
|
"Checking whether CXX compiler has utimensat" DIRECT)
|
2015-10-08 20:26:08 +03:00
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_STAT_HAS_ST_MTIM
|
|
|
|
"Checking whether CXX compiler struct stat has st_mtim member" DIRECT)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
|
|
|
|
"Checking whether CXX compiler struct stat has st_mtimespec member" DIRECT)
|
2013-06-03 18:23:31 +04:00
|
|
|
SET_PROPERTY(SOURCE SystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS
|
|
|
|
KWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
|
|
|
|
KWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
|
|
|
|
KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
|
|
|
|
KWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
|
|
|
|
KWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
|
2015-10-08 20:26:08 +03:00
|
|
|
KWSYS_CXX_STAT_HAS_ST_MTIM=${KWSYS_CXX_STAT_HAS_ST_MTIM}
|
|
|
|
KWSYS_CXX_STAT_HAS_ST_MTIMESPEC=${KWSYS_CXX_STAT_HAS_ST_MTIMESPEC}
|
2013-06-03 18:23:31 +04:00
|
|
|
)
|
2012-04-26 18:36:53 +04:00
|
|
|
ENDIF()
|
2010-06-29 16:44:33 +04:00
|
|
|
|
2012-05-02 16:46:10 +04:00
|
|
|
IF(KWSYS_USE_SystemInformation)
|
2013-01-14 18:41:52 +04:00
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P})
|
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
|
|
|
|
COMPILE_DEFINITIONS KWSYS_SYS_HAS_IFADDRS_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
|
|
|
|
COMPILE_DEFINITIONS KWSYS_SYS_HAS_PSAPI=1)
|
|
|
|
IF(MSVC70 OR MSVC71)
|
|
|
|
# Suppress LNK4089: all references to 'PSAPI.DLL' discarded by /OPT:REF
|
|
|
|
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4089")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2013-01-08 17:42:58 +04:00
|
|
|
IF(CMAKE_SYSTEM MATCHES "HP-UX")
|
|
|
|
CHECK_INCLUDE_FILES("sys/mpctl.h" KWSYS_SYS_HAS_MPCTL_H)
|
|
|
|
IF(KWSYS_SYS_HAS_MPCTL_H)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_SYS_HAS_MPCTL_H=1)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2013-01-11 20:34:59 +04:00
|
|
|
IF(CMAKE_SYSTEM MATCHES "BSD")
|
|
|
|
CHECK_INCLUDE_FILES("machine/cpu.h" KWSYS_SYS_HAS_MACHINE_CPU_H)
|
|
|
|
IF(KWSYS_SYS_HAS_MACHINE_CPU_H)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_SYS_HAS_MACHINE_CPU_H=1)
|
|
|
|
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
|
|
|
|
"Checking whether CXX compiler has rlimit64" DIRECT)
|
|
|
|
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
|
|
|
|
IF(KWSYS_CXX_HAS_RLIMIT64)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_CXX_HAS_RLIMIT64=1)
|
|
|
|
ENDIF()
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOL
|
|
|
|
"Checking whether CXX compiler has atol" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS_ATOL)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOL=1)
|
|
|
|
ENDIF()
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOLL
|
|
|
|
"Checking whether CXX compiler has atoll" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS_ATOLL)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOLL=1)
|
|
|
|
ENDIF()
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS__ATOI64
|
|
|
|
"Checking whether CXX compiler has _atoi64" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS__ATOI64)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_CXX_HAS__ATOI64=1)
|
|
|
|
ENDIF()
|
2013-08-07 16:18:32 +04:00
|
|
|
IF(UNIX)
|
|
|
|
INCLUDE(CheckIncludeFileCXX)
|
|
|
|
# check for simple stack trace
|
|
|
|
# usually it's in libc but on FreeBSD
|
|
|
|
# it's in libexecinfo
|
|
|
|
FIND_LIBRARY(EXECINFO_LIB "execinfo")
|
2014-03-04 19:19:33 +04:00
|
|
|
MARK_AS_ADVANCED(EXECINFO_LIB)
|
2013-08-07 16:18:32 +04:00
|
|
|
IF (NOT EXECINFO_LIB)
|
|
|
|
SET(EXECINFO_LIB "")
|
|
|
|
ENDIF()
|
|
|
|
CHECK_INCLUDE_FILE_CXX("execinfo.h" KWSYS_CXX_HAS_EXECINFOH)
|
|
|
|
IF (KWSYS_CXX_HAS_EXECINFOH)
|
|
|
|
# we have the backtrace header check if it
|
|
|
|
# can be used with this compiler
|
|
|
|
SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES ${EXECINFO_LIB})
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BACKTRACE
|
|
|
|
"Checking whether backtrace works with this C++ compiler" DIRECT)
|
|
|
|
SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES)
|
|
|
|
IF (KWSYS_CXX_HAS_BACKTRACE)
|
|
|
|
# backtrace is supported by this system and compiler.
|
|
|
|
# now check for the more advanced capabilities.
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE=1)
|
|
|
|
# check for symbol lookup using dladdr
|
|
|
|
CHECK_INCLUDE_FILE_CXX("dlfcn.h" KWSYS_CXX_HAS_DLFCNH)
|
|
|
|
IF (KWSYS_CXX_HAS_DLFCNH)
|
|
|
|
# we have symbol lookup libraries and headers
|
|
|
|
# check if they can be used with this compiler
|
|
|
|
SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES ${CMAKE_DL_LIBS})
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_DLADDR
|
|
|
|
"Checking whether dladdr works with this C++ compiler" DIRECT)
|
|
|
|
SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES)
|
|
|
|
IF (KWSYS_CXX_HAS_DLADDR)
|
|
|
|
# symbol lookup is supported by this system
|
|
|
|
# and compiler.
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP=1)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
# c++ demangling support
|
|
|
|
# check for cxxabi headers
|
|
|
|
CHECK_INCLUDE_FILE_CXX("cxxabi.h" KWSYS_CXX_HAS_CXXABIH)
|
|
|
|
IF (KWSYS_CXX_HAS_CXXABIH)
|
|
|
|
# check if cxxabi can be used with this
|
|
|
|
# system and compiler.
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CXXABI
|
|
|
|
"Checking whether cxxabi works with this C++ compiler" DIRECT)
|
|
|
|
IF (KWSYS_CXX_HAS_CXXABI)
|
|
|
|
# c++ demangle using cxxabi is supported with
|
|
|
|
# this system and compiler
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE=1)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
# basic backtrace works better with release build
|
|
|
|
# don't bother with advanced features for release
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS_DEBUG KWSYS_SYSTEMINFORMATION_HAS_DEBUG_BUILD=1)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS_RELWITHDEBINFO KWSYS_SYSTEMINFORMATION_HAS_DEBUG_BUILD=1)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2013-01-14 18:41:52 +04:00
|
|
|
IF(BORLAND)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM
|
|
|
|
"Checking whether Borland CXX compiler supports assembler instructions" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS_BORLAND_ASM)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM=1)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM_CPUID
|
|
|
|
"Checking whether Borland CXX compiler supports CPUID assembler instruction" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM_CPUID=1)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2012-11-01 00:44:00 +04:00
|
|
|
IF(KWSYS_USE___INT64)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_USE___INT64=1)
|
|
|
|
ENDIF()
|
|
|
|
IF(KWSYS_USE_LONG_LONG)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=1)
|
|
|
|
ENDIF()
|
|
|
|
IF(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM_LONG_LONG=1)
|
|
|
|
ENDIF()
|
|
|
|
IF(KWSYS_IOS_HAS_OSTREAM___INT64)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM___INT64=1)
|
|
|
|
ENDIF()
|
|
|
|
IF(KWSYS_BUILD_SHARED)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1)
|
|
|
|
ENDIF()
|
2015-06-04 16:22:53 +03:00
|
|
|
|
|
|
|
IF(UNIX AND NOT CYGWIN)
|
|
|
|
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_GETLOADAVG
|
|
|
|
"Checking whether CXX compiler has getloadavg" DIRECT)
|
|
|
|
IF(KWSYS_CXX_HAS_GETLOADAVG)
|
|
|
|
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS KWSYS_CXX_HAS_GETLOADAVG=1)
|
|
|
|
ENDIF()
|
|
|
|
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}")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2003-06-20 22:10:28 +04:00
|
|
|
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}
|
|
|
|
COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_RUNTIME}
|
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2009-09-28 19:36:54 +04:00
|
|
|
|
|
|
|
# Install the license under the documentation directory.
|
|
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt
|
|
|
|
DESTINATION ${KWSYS_INSTALL_DOC_DIR}/${KWSYS_NAMESPACE}
|
|
|
|
${KWSYS_INSTALL_LICENSE_OPTIONS})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2009-09-28 19:36:54 +04:00
|
|
|
|
2003-06-20 02:57:11 +04:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# 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
|
|
|
|
hashtable hash_fun hash_map hash_set
|
|
|
|
auto_ptr
|
|
|
|
)
|
2003-06-20 02:57:11 +04:00
|
|
|
|
|
|
|
# Add selected C++ classes.
|
2006-08-27 21:17:23 +04:00
|
|
|
SET(cppclasses
|
2013-11-25 20:19:42 +04:00
|
|
|
Directory DynamicLoader Encoding Glob RegularExpression SystemTools
|
|
|
|
CommandLineArguments IOStream FStream SystemInformation
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
2003-06-20 02:57:11 +04:00
|
|
|
|
|
|
|
# Add selected C components.
|
2008-02-28 00:07:14 +03:00
|
|
|
FOREACH(c
|
2015-12-17 22:46:12 +03:00
|
|
|
Process Base64 Encoding MD5 Terminal System String
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ELSE()
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2003-06-20 02:57:11 +04:00
|
|
|
|
2006-04-23 04:20:12 +04:00
|
|
|
# Add selected C sources.
|
2013-11-25 20:19:42 +04:00
|
|
|
FOREACH(c Base64 Encoding MD5 Terminal System String)
|
2006-04-23 04:20:12 +04:00
|
|
|
IF(KWSYS_USE_${c})
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}C.c)
|
|
|
|
LIST(APPEND KWSYS_C_SRCS ${c}C.c)
|
|
|
|
ELSE()
|
|
|
|
LIST(APPEND KWSYS_C_SRCS ${c}.c)
|
|
|
|
ENDIF()
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
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.
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}CXX.cxx)
|
|
|
|
LIST(APPEND KWSYS_CXX_SRCS ${c}CXX.cxx)
|
|
|
|
ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}.cxx)
|
|
|
|
LIST(APPEND KWSYS_CXX_SRCS ${c}.cxx)
|
|
|
|
ENDIF()
|
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
|
|
|
@ONLY IMMEDIATE)
|
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
|
|
|
DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
|
|
|
|
${KWSYS_INSTALL_INCLUDE_OPTIONS})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
2003-04-08 21:10:44 +04:00
|
|
|
|
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
|
|
|
@ONLY IMMEDIATE)
|
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
|
|
|
DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
|
|
|
|
${KWSYS_INSTALL_INCLUDE_OPTIONS})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
2003-06-10 23:46:31 +04:00
|
|
|
|
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
|
|
|
@ONLY IMMEDIATE)
|
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
|
|
|
DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
|
|
|
|
${KWSYS_INSTALL_INCLUDE_OPTIONS})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
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}
|
|
|
|
${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
|
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})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2012-10-01 23:18:30 +04:00
|
|
|
|
2013-08-07 16:18:32 +04:00
|
|
|
IF(KWSYS_USE_SystemInformation)
|
|
|
|
IF(WIN32)
|
|
|
|
TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ws2_32)
|
|
|
|
IF(KWSYS_SYS_HAS_PSAPI)
|
|
|
|
TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} Psapi)
|
|
|
|
ENDIF()
|
|
|
|
ELSEIF(UNIX)
|
|
|
|
IF (EXECINFO_LIB AND KWSYS_CXX_HAS_BACKTRACE)
|
|
|
|
# backtrace on FreeBSD is not in libc
|
|
|
|
TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${EXECINFO_LIB})
|
|
|
|
ENDIF()
|
|
|
|
IF (KWSYS_CXX_HAS_DLADDR)
|
|
|
|
# for symbol lookup using dladdr
|
|
|
|
TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS})
|
|
|
|
ENDIF()
|
2012-10-01 23:18:30 +04:00
|
|
|
ENDIF()
|
2013-08-07 16:18:32 +04:00
|
|
|
ENDIF()
|
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
|
|
|
|
${KWSYS_PROPERTIES_CXX}
|
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2005-08-05 01:12:22 +04:00
|
|
|
|
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})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2004-07-03 01:39:47 +04:00
|
|
|
|
|
|
|
# Add a C-only library if requested.
|
|
|
|
IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
|
|
|
|
ADD_LIBRARY(${KWSYS_NAMESPACE}_c ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS})
|
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)
|
2015-08-31 16:55:01 +03:00
|
|
|
SET_TARGET_PROPERTIES(${KWSYS_NAMESPACE}_c PROPERTIES
|
2005-08-05 01:12:22 +04:00
|
|
|
${KWSYS_PROPERTIES_C}
|
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2005-08-05 01:12:22 +04:00
|
|
|
|
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})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
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.
|
2014-10-31 20:11:58 +03:00
|
|
|
IF(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel"))
|
2012-10-01 23:18:30 +04:00
|
|
|
ADD_DEFINITIONS(
|
|
|
|
-D_CRT_NONSTDC_NO_DEPRECATE
|
|
|
|
-D_CRT_SECURE_NO_DEPRECATE
|
|
|
|
-D_CRT_SECURE_NO_WARNINGS
|
|
|
|
-D_SCL_SECURE_NO_DEPRECATE
|
|
|
|
)
|
|
|
|
ENDIF()
|
|
|
|
|
2014-03-04 19:19:33 +04:00
|
|
|
IF(WIN32)
|
|
|
|
# Help enforce the use of wide Windows apis.
|
|
|
|
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
|
|
|
|
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
|
|
|
|
COMPILE_FLAGS "-DKWSYS_STRING_C")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2009-06-10 19:46:06 +04:00
|
|
|
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(KWSYS_USE_Encoding)
|
|
|
|
# Set default 8 bit encoding in "EndcodingC.c".
|
|
|
|
SET_PROPERTY(SOURCE EncodingC.c APPEND PROPERTY COMPILE_DEFINITIONS
|
|
|
|
KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2013-11-25 20:19:42 +04:00
|
|
|
|
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}")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2006-01-04 16:32:35 +03:00
|
|
|
|
2007-03-03 18:47:06 +03:00
|
|
|
# C tests
|
|
|
|
SET(KWSYS_C_TESTS
|
2007-03-14 22:12:10 +03:00
|
|
|
testEncode
|
2007-03-03 18:47:06 +03:00
|
|
|
testTerminal
|
|
|
|
)
|
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(
|
|
|
|
KWSYS_C_TEST_SRCS ${KWSYS_NAMESPACE}TestsC.c
|
|
|
|
${KWSYS_C_TESTS}
|
|
|
|
)
|
|
|
|
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})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDFOREACH()
|
2007-03-03 18:47:06 +03:00
|
|
|
|
|
|
|
# C++ tests
|
2007-04-19 20:11:56 +04:00
|
|
|
IF(NOT WATCOM)
|
|
|
|
SET(KWSYS_CXX_TESTS
|
|
|
|
testAutoPtr
|
|
|
|
testHashSTL
|
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2007-04-19 20:11:56 +04:00
|
|
|
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
|
2007-03-03 18:47:06 +03:00
|
|
|
testIOS
|
|
|
|
testSystemTools
|
|
|
|
testCommandLineArguments
|
|
|
|
testCommandLineArguments1
|
|
|
|
)
|
2013-11-25 20:19:42 +04:00
|
|
|
IF(KWSYS_STL_HAS_WSTRING)
|
|
|
|
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
|
|
|
|
testEncoding
|
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2013-12-23 19:51:38 +04:00
|
|
|
IF(KWSYS_USE_FStream)
|
|
|
|
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
|
|
|
|
testFStream
|
|
|
|
)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2008-01-08 19:43:07 +03:00
|
|
|
IF(KWSYS_USE_SystemInformation)
|
|
|
|
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
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})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2007-03-03 18:47:06 +03:00
|
|
|
CREATE_TEST_SOURCELIST(
|
|
|
|
KWSYS_CXX_TEST_SRCS ${KWSYS_NAMESPACE}TestsCxx.cxx
|
|
|
|
${KWSYS_CXX_TESTS}
|
|
|
|
)
|
|
|
|
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})
|
2014-07-07 17:04:27 +04:00
|
|
|
|
|
|
|
SET(TEST_SYSTEMTOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
SET(TEST_SYSTEMTOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
2005-10-04 23:09:00 +04:00
|
|
|
CONFIGURE_FILE(
|
|
|
|
${PROJECT_SOURCE_DIR}/testSystemTools.h.in
|
|
|
|
${PROJECT_BINARY_DIR}/testSystemTools.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"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
|
|
|
|
SET_DIRECTORY_PROPERTIES(PROPERTIES TEST_INCLUDE_FILE "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2007-03-03 18:47:06 +03:00
|
|
|
|
|
|
|
SET(KWSYS_TEST_ARGS_testCommandLineArguments
|
2006-07-14 17:13:23 +04:00
|
|
|
--another-bool-variable
|
|
|
|
--long3=opt
|
|
|
|
--set-bool-arg1
|
|
|
|
-SSS ken brad bill andy
|
|
|
|
--some-bool-variable=true
|
|
|
|
--some-double-variable12.5
|
|
|
|
--some-int-variable 14
|
|
|
|
"--some-string-variable=test string with space"
|
|
|
|
--some-multi-argument 5 1 8 3 7 1 3 9 7 1
|
|
|
|
-N 12.5 -SS=andy -N 1.31 -N 22
|
|
|
|
-SS=bill -BBtrue -SS=brad
|
2007-03-03 18:47:06 +03:00
|
|
|
-BBtrue
|
2006-07-14 17:13:23 +04:00
|
|
|
-BBfalse
|
|
|
|
-SS=ken
|
|
|
|
-A
|
|
|
|
-C=test
|
2007-03-03 18:47:06 +03:00
|
|
|
--long2 hello
|
|
|
|
)
|
|
|
|
SET(KWSYS_TEST_ARGS_testCommandLineArguments1
|
2006-07-14 23:02:27 +04:00
|
|
|
--ignored
|
|
|
|
-n 24
|
|
|
|
--second-ignored
|
|
|
|
"-m=test value"
|
|
|
|
third-ignored
|
|
|
|
-p
|
2007-03-03 18:47:06 +03:00
|
|
|
some junk at the end
|
|
|
|
)
|
|
|
|
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})
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDFOREACH()
|
2007-03-03 18:47:06 +03:00
|
|
|
|
|
|
|
# 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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
2015-07-31 16:26:35 +03:00
|
|
|
FOREACH(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7} 9 10)
|
2007-03-03 18:47:06 +03:00
|
|
|
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)
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDFOREACH()
|
2007-03-03 18:47:06 +03:00
|
|
|
|
2009-11-23 23:31:29 +03:00
|
|
|
# Some Apple compilers produce bad optimizations in this source.
|
2014-10-31 20:11:58 +03:00
|
|
|
IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$")
|
2009-11-23 23:31:29 +03:00
|
|
|
SET_SOURCE_FILES_PROPERTIES(testProcess.c PROPERTIES COMPILE_FLAGS -O0)
|
2014-03-08 00:22:35 +04:00
|
|
|
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL")
|
|
|
|
# Tell IBM XL not to warn about our test infinite loop
|
|
|
|
SET_PROPERTY(SOURCE testProcess.c PROPERTY COMPILE_FLAGS -qsuppress=1500-010)
|
2009-11-23 23:31:29 +03:00
|
|
|
ENDIF()
|
|
|
|
|
2008-09-26 16:24:31 +04:00
|
|
|
# Test SharedForward
|
|
|
|
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/testSharedForward.c.in
|
|
|
|
${PROJECT_BINARY_DIR}/testSharedForward.c @ONLY IMMEDIATE)
|
|
|
|
ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestSharedForward
|
|
|
|
${PROJECT_BINARY_DIR}/testSharedForward.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
|
|
|
|
2015-07-31 16:26:35 +03:00
|
|
|
# Set up ctest custom configuration file.
|
|
|
|
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/CTestCustom.cmake.in
|
|
|
|
${PROJECT_BINARY_DIR}/CTestCustom.cmake @ONLY)
|
|
|
|
|
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()
|
|
|
|
|
2014-11-12 16:58:42 +03:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|