1 #=============================================================================
3 # Program: KWSys - Kitware System Library
4 # Module: $RCSfile: CMakeLists.txt,v $
6 # Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
7 # See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 # This software is distributed WITHOUT ANY WARRANTY; without even
10 # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 # PURPOSE. See the above copyright notices for more information.
13 #=============================================================================
15 # The Kitware System Library is intended to be included in other
16 # projects. It is completely configurable in that the library's
17 # namespace can be configured and the components that are included can
18 # be selected invididually.
20 # Typical usage is to import the kwsys directory tree into a
21 # subdirectory under a parent project and enable the classes that will
22 # be used. All classes are disabled by default. The CMake listfile
23 # above this one configures the library as follows:
25 # SET(KWSYS_NAMESPACE foosys)
26 # SET(KWSYS_USE_Directory 1) # Enable Directory class.
29 # Optional settings are as follows:
31 # KWSYS_HEADER_ROOT = The directory into which to generate the kwsys headers.
32 # A directory called "${KWSYS_NAMESPACE}" will be
33 # created under this root directory to hold the files.
37 # SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
38 # INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
40 # KWSYS_LIBRARY_INSTALL_DIR = The installation target directories into
41 # KWSYS_HEADER_INSTALL_DIR which the libraries and headers from
42 # kwsys should be installed by a "make install".
43 # The values should be specified relative to
44 # the installation prefix and start with a '/'.
47 # SET(KWSYS_LIBRARY_INSTALL_DIR /lib)
48 # SET(KWSYS_HEADER_INSTALL_DIR /include)
50 # KWSYS_IOS_FORCE_OLD = Force use of old non-ANSI C++ streams even if
51 # new streams are available. This may be used
52 # by projects that cannot configure their
56 # SET(KWSYS_IOS_FORCE_OLD 1)
59 # Once configured, kwsys should be used as follows from C or C++ code:
61 # #include <foosys/Directory.hxx>
63 # foosys::Directory directory;
66 #-----------------------------------------------------------------------------
67 # If a namespace is not specified, use "kwsys" and enable testing.
68 # This should be the case only when kwsys is not included inside
69 # another project and is being tested.
70 IF(NOT KWSYS_NAMESPACE)
71 SET(KWSYS_NAMESPACE "kwsys")
72 SET(KWSYS_STANDALONE 1)
73 ENDIF(NOT KWSYS_NAMESPACE)
75 IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
78 # Enable all components.
79 SET(KWSYS_USE_Base64 1)
80 SET(KWSYS_USE_Directory 1)
81 SET(KWSYS_USE_Process 1)
82 SET(KWSYS_USE_RegularExpression 1)
83 SET(KWSYS_USE_SystemTools 1)
84 SET(KWSYS_USE_CommandLineArguments 1)
85 ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
87 #-----------------------------------------------------------------------------
88 # The project name is that of the specified namespace.
89 PROJECT(${KWSYS_NAMESPACE})
91 # Enable testing if building standalone.
94 MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
98 ENDIF(KWSYS_STANDALONE)
100 # Do full dependency headers.
101 INCLUDE_REGULAR_EXPRESSION("^.*$")
103 # Work-around for CMake 1.6.7 bug in custom command dependencies when
104 # there is no executable output path.
105 IF(NOT EXECUTABLE_OUTPUT_PATH)
106 SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}" CACHE PATH
107 "Output directory for executables.")
108 ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
110 # Generated source files will need this header.
111 STRING(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
112 KWSYS_IN_SOURCE_BUILD)
113 IF(NOT KWSYS_IN_SOURCE_BUILD)
114 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsysPrivate.h
115 ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE)
116 ENDIF(NOT KWSYS_IN_SOURCE_BUILD)
118 #-----------------------------------------------------------------------------
119 # We require ANSI support from the C compiler. Add any needed flags.
120 IF(CMAKE_ANSI_CFLAGS)
121 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
122 ENDIF(CMAKE_ANSI_CFLAGS)
124 #-----------------------------------------------------------------------------
125 # Adjust compiler flags for some platforms.
126 IF(NOT CMAKE_COMPILER_IS_GNUCXX)
127 IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
128 STRING(REGEX MATCH "-timplicit_local"
129 KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL "${CMAKE_CXX_FLAGS}")
130 STRING(REGEX MATCH "-no_implicit_include"
131 KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE "${CMAKE_CXX_FLAGS}")
132 IF(NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL)
133 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local")
134 ENDIF(NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL)
135 IF(NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE)
136 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include")
137 ENDIF(NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE)
138 ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
139 ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
141 #-----------------------------------------------------------------------------
142 # Configure the standard library header wrappers based on compiler's
143 # capabilities and parent project's request. Enforce 0/1 as only
144 # possible values for configuration into Configure.hxx.
145 INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake)
147 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
148 "Checking whether STL classes are in std namespace" DIRECT)
150 IF(KWSYS_IOS_FORCE_OLD)
151 SET(KWSYS_IOS_USE_ANSI 0)
152 ELSE(KWSYS_IOS_FORCE_OLD)
153 KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_ANSI
154 "Checking whether ANSI stream headers are available" DIRECT)
155 ENDIF(KWSYS_IOS_FORCE_OLD)
157 IF(KWSYS_IOS_USE_ANSI)
158 KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STD
159 "Checking whether ANSI streams are in std namespace" DIRECT)
160 KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_SSTREAM
161 "Checking whether ANSI string stream is available" DIRECT)
162 ELSE(KWSYS_IOS_USE_ANSI)
163 SET(KWSYS_IOS_HAVE_STD 0)
164 SET(KWSYS_IOS_USE_SSTREAM 0)
165 ENDIF(KWSYS_IOS_USE_ANSI)
167 IF(KWSYS_IOS_USE_SSTREAM)
168 SET(KWSYS_IOS_USE_STRSTREAM_H 0)
169 SET(KWSYS_IOS_USE_STRSTREA_H 0)
170 ELSE(KWSYS_IOS_USE_SSTREAM)
171 KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_STRSTREAM_H
172 "Checking whether strstream.h is available" DIRECT)
173 IF(KWSYS_IOS_USE_STRSTREAM_H)
174 SET(KWSYS_IOS_USE_STRSTREA_H 0)
175 ELSE(KWSYS_IOS_USE_STRSTREAM_H)
176 KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_STRSTREA_H
177 "Checking whether strstrea.h is available" DIRECT)
178 ENDIF(KWSYS_IOS_USE_STRSTREAM_H)
179 ENDIF(KWSYS_IOS_USE_SSTREAM)
181 SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
182 -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD})
183 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_NEQ_CHAR
184 "Checking whether stl string has operator!= for char*" DIRECT)
185 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_TRAITS
186 "Checking whether stl has iterator_traits" DIRECT)
187 IF(KWSYS_STL_HAS_ITERATOR_TRAITS)
188 SET(KWSYS_STL_HAS_ITERATOR_CATEGORY 0)
189 SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
190 ELSE(KWSYS_STL_HAS_ITERATOR_TRAITS)
191 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_CATEGORY
192 "Checking whether stl has old iterator_category" DIRECT)
193 IF(KWSYS_STL_HAS_ITERATOR_CATEGORY)
194 SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
195 ELSE(KWSYS_STL_HAS_ITERATOR_CATEGORY)
196 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS___ITERATOR_CATEGORY
197 "Checking whether stl has internal __iterator_category" DIRECT)
198 ENDIF(KWSYS_STL_HAS_ITERATOR_CATEGORY)
199 ENDIF(KWSYS_STL_HAS_ITERATOR_TRAITS)
200 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
201 "Checking whether stl has old non-template allocator" DIRECT)
202 IF(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE)
203 SET(KWSYS_STL_HAS_ALLOCATOR_REBIND 0)
204 SET(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT 0)
205 ELSE(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE)
206 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_REBIND
207 "Checking for rebind member of stl allocator" DIRECT)
208 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
209 "Checking for non-standard argument to stl allocator<>::max_size" DIRECT)
210 ENDIF(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE)
211 IF(KWSYS_IOS_USE_ANSI)
212 # ANSI streams always have string operators.
213 SET(KWSYS_STL_STRING_HAVE_OSTREAM 1)
214 SET(KWSYS_STL_STRING_HAVE_ISTREAM 1)
215 ELSE(KWSYS_IOS_USE_ANSI)
216 # There may not be string operators for old streams.
217 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_OSTREAM
218 "Checking whether stl string has ostream operator<<" DIRECT)
219 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_ISTREAM
220 "Checking whether stl string has istream operator>>" DIRECT)
221 ENDIF(KWSYS_IOS_USE_ANSI)
222 SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
224 KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
225 "Checking whether \"<>\" is needed for template friends" INVERT)
226 KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_MEMBER_TEMPLATES
227 "Checking for member template support" DIRECT)
228 KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_FULL_SPECIALIZATION
229 "Checking for standard template specialization syntax" DIRECT)
230 KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
231 "Checking whether argument dependent lookup is supported" DIRECT)
234 KWSYS_PLATFORM_CXX_TEST(KWSYS_STAT_HAS_ST_MTIM
235 "Checking whether struct stat has st_mtim member" DIRECT)
238 IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
239 SET(KWSYS_NAME_IS_KWSYS 1)
240 ELSE(KWSYS_NAMESPACE MATCHES "^kwsys$")
241 SET(KWSYS_NAME_IS_KWSYS 0)
242 ENDIF(KWSYS_NAMESPACE MATCHES "^kwsys$")
244 # Choose default shared/static build if not specified.
245 IF(KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$")
246 SET(KWSYS_BUILD_SHARED ${BUILD_SHARED_LIBS})
247 ENDIF(KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$")
249 IF(KWSYS_BUILD_SHARED)
250 SET(KWSYS_BUILD_SHARED 1)
251 SET(KWSYS_LIBRARY_TYPE SHARED)
252 ELSE(KWSYS_BUILD_SHARED)
253 SET(KWSYS_BUILD_SHARED 0)
254 SET(KWSYS_LIBRARY_TYPE STATIC)
255 ENDIF(KWSYS_BUILD_SHARED)
257 #-----------------------------------------------------------------------------
258 # Choose a directory for the generated headers.
259 IF(NOT KWSYS_HEADER_ROOT)
260 SET(KWSYS_HEADER_ROOT "${PROJECT_BINARY_DIR}")
261 ENDIF(NOT KWSYS_HEADER_ROOT)
262 SET(KWSYS_HEADER_DIR "${KWSYS_HEADER_ROOT}/${KWSYS_NAMESPACE}")
263 INCLUDE_DIRECTORIES(${KWSYS_HEADER_ROOT})
265 #-----------------------------------------------------------------------------
266 # Create STL header wrappers to block warnings in the STL headers and
267 # give standard names by which they may be included.
268 SET(KWSYS_STL_HEADER_EXTRA_string 1)
269 FOREACH(header algorithm deque iterator list map numeric queue set stack string
270 utility vector memory functional)
271 # Configure the header wrapper.
272 SET(KWSYS_STL_HEADER "${header}")
273 IF(KWSYS_STL_HEADER_EXTRA_${header})
274 SET(KWSYS_STL_HEADER_EXTRA
275 "#define ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n# include <${KWSYS_NAMESPACE}/stl/${header}.hxx>\n#undef ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n")
276 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl_${header}.hxx.in
277 ${KWSYS_HEADER_DIR}/stl/${header}.hxx
279 IF(KWSYS_HEADER_INSTALL_DIR)
280 INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/stl
281 FILES ${KWSYS_HEADER_DIR}/stl/${header}.hxx)
282 ENDIF(KWSYS_HEADER_INSTALL_DIR)
283 ELSE(KWSYS_STL_HEADER_EXTRA_${header})
284 SET(KWSYS_STL_HEADER_EXTRA "")
285 ENDIF(KWSYS_STL_HEADER_EXTRA_${header})
286 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl.hxx.in
287 ${KWSYS_HEADER_DIR}/stl/${header}
290 # Create an install target for the header wrapper.
291 IF(KWSYS_HEADER_INSTALL_DIR)
292 INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/stl
293 FILES ${KWSYS_HEADER_DIR}/stl/${header})
294 ENDIF(KWSYS_HEADER_INSTALL_DIR)
297 #-----------------------------------------------------------------------------
298 # Create streams header wrappers to give standard names by which they
300 FOREACH(header iostream fstream sstream iosfwd)
301 # Configure the header wrapper.
302 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_ios_${header}.h.in
303 ${KWSYS_HEADER_DIR}/ios/${header}
306 # Create an install target for the header wrapper.
307 IF(KWSYS_HEADER_INSTALL_DIR)
308 INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/ios
309 FILES ${KWSYS_HEADER_DIR}/ios/${header})
310 ENDIF(KWSYS_HEADER_INSTALL_DIR)
313 #-----------------------------------------------------------------------------
314 # Build a list of classes and headers we need to implement the
315 # selected components. Initialize with required components.
317 SET(KWSYS_H_FILES Configure SharedForward)
318 SET(KWSYS_HXX_FILES Configure hashtable hash_fun hash_map hash_set)
320 # Enforce component dependencies.
321 IF(KWSYS_USE_SystemTools)
322 SET(KWSYS_USE_Directory 1)
323 ENDIF(KWSYS_USE_SystemTools)
325 # Add selected C++ classes.
326 FOREACH(c Directory RegularExpression SystemTools CommandLineArguments)
328 SET(KWSYS_CLASSES ${KWSYS_CLASSES} ${c})
329 ENDIF(KWSYS_USE_${c})
332 # Add selected C components.
333 FOREACH(c Process Base64)
335 SET(KWSYS_H_FILES ${KWSYS_H_FILES} ${c})
336 ENDIF(KWSYS_USE_${c})
339 #-----------------------------------------------------------------------------
340 # Build a list of sources for the library based on components that are
345 # Add the proper sources for this platform's Process implementation.
346 IF(KWSYS_USE_Process)
348 # Use the Windows implementation. We need the encoded forwarding executable.
349 SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessWin32.c
350 ${PROJECT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c)
351 SET_SOURCE_FILES_PROPERTIES(
352 ${PROJECT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
353 PROPERTIES GENERATED 1)
355 # Use the UNIX implementation.
356 SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessUNIX.c)
358 ENDIF(KWSYS_USE_Process)
360 # Add sources for Base64 encoding.
362 SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} Base64.c)
363 ENDIF(KWSYS_USE_Base64)
365 # Configure headers of C++ classes and construct the list of sources.
366 FOREACH(c ${KWSYS_CLASSES})
367 # Add this source to the list of source files for the library.
368 SET(KWSYS_CXX_SRCS ${KWSYS_CXX_SRCS} ${c}.cxx)
370 # Configure the header for this class.
371 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${c}.hxx.in ${KWSYS_HEADER_DIR}/${c}.hxx
374 # Create an install target for the header.
375 IF(KWSYS_HEADER_INSTALL_DIR)
376 INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}
377 FILES ${KWSYS_HEADER_DIR}/${c}.hxx)
378 ENDIF(KWSYS_HEADER_INSTALL_DIR)
381 # Configure C headers.
382 FOREACH(h ${KWSYS_H_FILES})
383 # Configure the header into the given directory.
384 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${h}.h.in ${KWSYS_HEADER_DIR}/${h}.h
387 # Create an install target for the header.
388 IF(KWSYS_HEADER_INSTALL_DIR)
389 INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}
390 FILES ${KWSYS_HEADER_DIR}/${h}.h)
391 ENDIF(KWSYS_HEADER_INSTALL_DIR)
394 # Configure other C++ headers.
395 FOREACH(h ${KWSYS_HXX_FILES})
396 # Configure the header into the given directory.
397 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${h}.hxx.in ${KWSYS_HEADER_DIR}/${h}.hxx
400 # Create an install target for the header.
401 IF(KWSYS_HEADER_INSTALL_DIR)
402 INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}
403 FILES ${KWSYS_HEADER_DIR}/${h}.hxx)
404 ENDIF(KWSYS_HEADER_INSTALL_DIR)
407 #-----------------------------------------------------------------------------
408 # Add the library with the configured name and list of sources.
409 IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
410 ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE}
411 ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
413 # Create an install target for the library.
414 IF(KWSYS_LIBRARY_INSTALL_DIR)
415 INSTALL_TARGETS(${KWSYS_LIBRARY_INSTALL_DIR} ${KWSYS_NAMESPACE})
416 ENDIF(KWSYS_LIBRARY_INSTALL_DIR)
417 ENDIF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
419 # Add a C-only library if requested.
420 IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
421 ADD_LIBRARY(${KWSYS_NAMESPACE}_c ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS})
423 # Create an install target for the library.
424 IF(KWSYS_LIBRARY_INSTALL_DIR)
425 INSTALL_TARGETS(${KWSYS_LIBRARY_INSTALL_DIR} ${KWSYS_NAMESPACE}_c)
426 ENDIF(KWSYS_LIBRARY_INSTALL_DIR)
427 ENDIF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
429 # For building kwsys itself, we use a macro defined on the command
430 # line to configure the namespace in the C and C++ source files.
431 ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
433 #-----------------------------------------------------------------------------
434 # Process execution on windows needs to build a forwarding executable
435 # that works around a Win9x bug. We encode the executable into a C
436 # file and build it into the library. Win9x platforms reproduce the
437 # executable into a temporary directory when it is needed.
438 IF(KWSYS_USE_Process)
440 # Build the forwarding executable itself and a program that will
441 # encode it into a C file.
442 ADD_EXECUTABLE(${KWSYS_NAMESPACE}ProcessFwd9x ProcessFwd9x.c)
443 ADD_EXECUTABLE(${KWSYS_NAMESPACE}EncodeExecutable EncodeExecutable.c)
445 # Construct the location of the executable to be encoded.
446 SET(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
447 IF(EXECUTABLE_OUTPUT_PATH)
448 SET(BIN_DIR ${EXECUTABLE_OUTPUT_PATH})
449 ENDIF(EXECUTABLE_OUTPUT_PATH)
451 SET(CFG_INTDIR "/${CMAKE_CFG_INTDIR}")
452 IF(CMAKE_BUILD_TOOL MATCHES "make")
454 ENDIF(CMAKE_BUILD_TOOL MATCHES "make")
456 # Take advantage of a better custom command syntax if possible.
457 SET(CMD ${BIN_DIR}${CFG_INTDIR}/${KWSYS_NAMESPACE}EncodeExecutable.exe)
458 SET(FWD ${BIN_DIR}${CFG_INTDIR}/${KWSYS_NAMESPACE}ProcessFwd9x.exe)
459 IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
461 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
463 ARGS ${FWD} ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
464 ${KWSYS_NAMESPACE} ProcessFwd9x
465 DEPENDS ${CMD} ${FWD})
466 ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
468 TARGET ${KWSYS_NAMESPACE}
469 SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ProcessFwd9x.c
471 ARGS ${FWD} ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
472 ${KWSYS_NAMESPACE} ProcessFwd9x
473 OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
474 DEPENDS ${CMD} ${FWD})
475 ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
477 # Make sure build occurs in proper order.
478 ADD_DEPENDENCIES(${KWSYS_NAMESPACE} ${KWSYS_NAMESPACE}ProcessFwd9x
479 ${KWSYS_NAMESPACE}EncodeExecutable)
481 ENDIF(KWSYS_USE_Process)
483 #-----------------------------------------------------------------------------
484 # Setup testing if not being built as part of another project.
485 IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
491 testCommandLineArguments
493 ADD_EXECUTABLE(${test} ${test}.cxx)
494 TARGET_LINK_LIBRARIES(${test} ${KWSYS_NAMESPACE})
500 ADD_EXECUTABLE(${test} ${test}.c)
501 TARGET_LINK_LIBRARIES(${test} ${KWSYS_NAMESPACE}_c)
504 SET(EXEC_DIR "${CMAKE_CURRENT_BINARY_DIR}")
505 IF(EXECUTABLE_OUTPUT_PATH)
506 SET(EXEC_DIR "${EXECUTABLE_OUTPUT_PATH}")
507 ENDIF(EXECUTABLE_OUTPUT_PATH)
510 ADD_TEST(kwsys-testSystemTools ${EXEC_DIR}/testSystemTools)
511 ADD_TEST(kwsys-testProcess-1 ${EXEC_DIR}/testProcess 1)
512 ADD_TEST(kwsys-testProcess-2 ${EXEC_DIR}/testProcess 2)
513 ADD_TEST(kwsys-testProcess-3 ${EXEC_DIR}/testProcess 3)
514 ADD_TEST(kwsys-testProcess-4 ${EXEC_DIR}/testProcess 4)
515 ADD_TEST(kwsys-testProcess-5 ${EXEC_DIR}/testProcess 5)
516 ADD_TEST(kwsys-testProcess-6 ${EXEC_DIR}/testProcess 6)
517 ADD_TEST(kwsys-testhash ${EXEC_DIR}/testhash)
519 ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)