summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/CMakeLists.txt
blob: 4d0fb0e869c7f1029717e44145ba0fa97096f268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
IF(NOT KWSYS_NAMESPACE)
  SET(KWSYS_NAMESPACE "kwsys")
  SET(KWSYS_DEFAULTS 1)
ENDIF(NOT KWSYS_NAMESPACE)

PROJECT(${KWSYS_NAMESPACE})
INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake)
CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM)

IF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
  SET(CMAKE_NO_ANSI_STRING_STREAM 1)
ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM)

SET(KWSYS_NO_STD_NAMESPACE ${CMAKE_NO_STD_NAMESPACE})
SET(KWSYS_NO_ANSI_STREAM_HEADERS ${CMAKE_NO_ANSI_STREAM_HEADERS})
SET(KWSYS_NO_ANSI_STRING_STREAM ${CMAKE_NO_ANSI_STRING_STREAM})
SET(KWSYS_NO_ANSI_FOR_SCOPE ${CMAKE_NO_ANSI_FOR_SCOPE})

SET(CLASSES Directory RegularExpression SystemTools)
SET(HEADERS Configure)

SET(SRCS)
SET(KWSYS_INCLUDES)
FOREACH(c ${CLASSES})
  SET(SRCS ${SRCS} ${c}.cxx)
  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${c}.hxx.in
                 ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/${c}.hxx
                 @ONLY IMMEDIATE)
  SET(KWSYS_INCLUDES ${KWSYS_INCLUDES}
      ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/${c}.hxx)
ENDFOREACH(c)

FOREACH(h ${HEADERS})
  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${h}.hxx.in
                 ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/${h}.hxx
                 @ONLY IMMEDIATE)
  SET(KWSYS_INCLUDES ${KWSYS_INCLUDES}
      ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/${h}.hxx)
ENDFOREACH(h)

ADD_LIBRARY(${KWSYS_NAMESPACE} ${SRCS})

ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
INCLUDE_DIRECTORIES(BEFORE ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE})

IF(KWSYS_LIBRARY_INSTALL_DIR)
  INSTALL_TARGETS(${KWSYS_LIBRARY_INSTALL_DIR} ${KWSYS_NAMESPACE})
ENDIF(KWSYS_LIBRARY_INSTALL_DIR)

IF(KWSYS_INCLUDE_INSTALL_DIR)
  INSTALL_FILES(${KWSYS_INCLUDE_INSTALL_DIR}/${KWSYS_NAMESPACE}
                FILES ${KWSYS_INCLUDES})
ENDIF(KWSYS_INCLUDE_INSTALL_DIR)

#-----------------------------------------------------------------------------
# Create STL header wrappers to block warnings in the STL headers.
FOREACH(header algorithm deque iterator list map numeric queue set stack string
               utility vector)
  SET(KWSYS_STL_HEADER "${header}")
  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std.h.in
                 ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header}
                 @ONLY IMMEDIATE)
  IF(KWSYS_INCLUDE_INSTALL_DIR)
    INSTALL_FILES(${KWSYS_INCLUDE_INSTALL_DIR}/${KWSYS_NAMESPACE}
      FILES ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header})
  ENDIF(KWSYS_INCLUDE_INSTALL_DIR)
ENDFOREACH(header)

FOREACH(header iostream fstream sstream iosfwd)
  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std_${header}.h.in
                 ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header}
                 @ONLY IMMEDIATE)
  IF(KWSYS_INCLUDE_INSTALL_DIR)
    INSTALL_FILES(${KWSYS_INCLUDE_INSTALL_DIR}/${KWSYS_NAMESPACE}
      FILES ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header})
  ENDIF(KWSYS_INCLUDE_INSTALL_DIR)
ENDFOREACH(header)

IF(KWSYS_DEFAULTS)
  INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/..)
  ADD_EXECUTABLE(test1 test1.cxx)
  TARGET_LINK_LIBRARIES(test1 ${KWSYS_NAMESPACE})
ENDIF(KWSYS_DEFAULTS)