blob: 4afa4d83a86cdc334d0c2502be5d6ed2749fdb99 (
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
IF(NOT KWSYS_NAMESPACE)
SET(KWSYS_NAMESPACE "kwsys")
SET(KWSYS_DEFAULTS 1)
ENDIF(NOT KWSYS_NAMESPACE)
PROJECT(${KWSYS_NAMESPACE})
# Work-around for CMake 1.6.7 bug in custom command dependencies when
# there is no executable output path.
IF(NOT EXECUTABLE_OUTPUT_PATH)
SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}" CACHE PATH
"Output directory for executables.")
ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
# Choose a default directory for the headers if none is given.
IF(NOT KWSYS_HEADER_DIR)
SET(KWSYS_HEADER_DIR "${PROJECT_BINARY_DIR}/${KWSYS_NAMESPACE}")
ENDIF(NOT KWSYS_HEADER_DIR)
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)
CHECK_INCLUDE_FILE_CXX("iosfwd" CMAKE_ANSI_IOSFWD_HEADER)
IF(NOT CMAKE_ANSI_IOSFWD_HEADER)
SET(CMAKE_NO_ANSI_STREAM_HEADERS 1)
ENDIF(NOT CMAKE_ANSI_IOSFWD_HEADER)
IF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
SET(CMAKE_NO_ANSI_STRING_STREAM 1)
ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
IF(KWSYS_FORCE_OLD_STREAMS)
SET(CMAKE_NO_ANSI_STREAM_HEADERS 1)
SET(CMAKE_NO_ANSI_STRING_STREAM 1)
ENDIF(KWSYS_FORCE_OLD_STREAMS)
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})
IF(CMAKE_ANSI_CFLAGS)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
ENDIF(CMAKE_ANSI_CFLAGS)
SET(CLASSES Directory RegularExpression SystemTools)
SET(H Process)
SET(HXX Configure)
IF(NOT UNIX)
ADD_EXECUTABLE(${KWSYS_NAMESPACE}ProcessFwd9x ProcessFwd9x.c)
ADD_EXECUTABLE(${KWSYS_NAMESPACE}EncodeExecutable EncodeExecutable.c)
SET(SRCS ProcessWin32.c ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
PROPERTIES GENERATED 1)
ELSE(NOT UNIX)
SET(SRCS ProcessUNIX.c)
ENDIF(NOT UNIX)
SET(KWSYS_INCLUDES)
FOREACH(c ${CLASSES})
SET(SRCS ${SRCS} ${c}.cxx)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${c}.hxx.in
${KWSYS_HEADER_DIR}/${c}.hxx
@ONLY IMMEDIATE)
SET(KWSYS_INCLUDES ${KWSYS_INCLUDES}
${KWSYS_HEADER_DIR}/${c}.hxx)
ENDFOREACH(c)
FOREACH(h ${H})
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${h}.h.in
${KWSYS_HEADER_DIR}/${h}.h
@ONLY IMMEDIATE)
SET(KWSYS_INCLUDES ${KWSYS_INCLUDES}
${KWSYS_HEADER_DIR}/${h}.h)
ENDFOREACH(h)
FOREACH(h ${HXX})
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${h}.hxx.in
${KWSYS_HEADER_DIR}/${h}.hxx
@ONLY IMMEDIATE)
SET(KWSYS_INCLUDES ${KWSYS_INCLUDES}
${KWSYS_HEADER_DIR}/${h}.hxx)
ENDFOREACH(h)
ADD_LIBRARY(${KWSYS_NAMESPACE} ${SRCS})
ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
INCLUDE_DIRECTORIES(BEFORE ${KWSYS_HEADER_DIR})
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
${KWSYS_HEADER_DIR}/std/${header}
@ONLY IMMEDIATE)
IF(KWSYS_INCLUDE_INSTALL_DIR)
INSTALL_FILES(${KWSYS_INCLUDE_INSTALL_DIR}/${KWSYS_NAMESPACE}
FILES ${KWSYS_HEADER_DIR}/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
${KWSYS_HEADER_DIR}/std/${header}
@ONLY IMMEDIATE)
IF(KWSYS_INCLUDE_INSTALL_DIR)
INSTALL_FILES(${KWSYS_INCLUDE_INSTALL_DIR}/${KWSYS_NAMESPACE}
FILES ${KWSYS_HEADER_DIR}/std/${header})
ENDIF(KWSYS_INCLUDE_INSTALL_DIR)
ENDFOREACH(header)
IF(KWSYS_DEFAULTS)
INCLUDE_DIRECTORIES(${KWSYS_HEADER_DIR}/..)
ADD_EXECUTABLE(testProcess testProcess.c)
ADD_EXECUTABLE(test1 test1.cxx)
TARGET_LINK_LIBRARIES(testProcess ${KWSYS_NAMESPACE})
TARGET_LINK_LIBRARIES(test1 ${KWSYS_NAMESPACE})
ENDIF(KWSYS_DEFAULTS)
IF(NOT UNIX)
SET(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
IF(EXECUTABLE_OUTPUT_PATH)
SET(BIN_DIR ${EXECUTABLE_OUTPUT_PATH})
ENDIF(EXECUTABLE_OUTPUT_PATH)
SET(MAKE_SYSTEM)
SET(CFG_INTDIR "/${CMAKE_CFG_INTDIR}")
IF(CMAKE_BUILD_TOOL MATCHES "make")
SET(CFG_INTDIR "")
ENDIF(CMAKE_BUILD_TOOL MATCHES "make")
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(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
COMMAND ${CMD}
ARGS ${FWD} ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
${KWSYS_NAMESPACE} ProcessFwd9x
DEPENDS ${CMD} ${FWD})
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
ADD_CUSTOM_COMMAND(
TARGET ${KWSYS_NAMESPACE}
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ProcessFwd9x.c
COMMAND ${CMD}
ARGS ${FWD} ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
${KWSYS_NAMESPACE} ProcessFwd9x
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
DEPENDS ${CMD} ${FWD})
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
ADD_DEPENDENCIES(${KWSYS_NAMESPACE} ${KWSYS_NAMESPACE}ProcessFwd9x
${KWSYS_NAMESPACE}EncodeExecutable)
ENDIF(NOT UNIX)
|