ENH: this variable overrides all PROJECT_URL. Check the dashboard, all projects have...
[cmake.git] / CMakeLists.txt
blob2ea0ba7fbfa43a4bd06d51a61b81f8566bff6e49
1 PROJECT(CMake)
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
3 MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
5 # The CMake version number.
6 SET(CMake_VERSION_MAJOR 2)
7 SET(CMake_VERSION_MINOR 5)
8 SET(CMake_VERSION_PATCH 0)
9 SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
10 SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
12 SET(BUILD_SHARED_LIBS OFF)
14 # The CMake executables do not need any rpath to run in the build or
15 # install tree.
16 SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
18 SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}" CACHE STRING
19   "Install location for data (relative to prefix).")
20 SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION}" CACHE STRING
21   "Install location for documentation (relative to prefix).")
22 SET(CMAKE_MAN_DIR "/man" CACHE STRING
23   "Install location for man pages (relative to prefix).")
24 MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
26 IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
27   IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
28     SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
29   ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
30   IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
31     SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
32   ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
33   INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
34 ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
36 # Disable deprecation warnings for standard C functions.
37 IF(CMAKE_COMPILER_2005)
38   ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
39 ENDIF(CMAKE_COMPILER_2005)
41 #silence duplicate symbol warnings on AIX
42 IF(CMAKE_SYSTEM MATCHES "AIX.*")
43   IF(NOT CMAKE_COMPILER_IS_GNUCXX)
44     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
45   ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
46 ENDIF(CMAKE_SYSTEM MATCHES "AIX.*")
48 IF(CMAKE_SYSTEM MATCHES "IRIX.*")
49   IF(NOT CMAKE_COMPILER_IS_GNUCXX)
50     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
51     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
52   ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
53 ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
55 IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
56   IF(NOT CMAKE_COMPILER_IS_GNUCXX)
57     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
58   ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
59 ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
61 #-----------------------------------------------------------------------------
62 # Create the kwsys library for CMake.
63 SET(KWSYS_NAMESPACE cmsys)
64 SET(KWSYS_USE_SystemTools 1)
65 SET(KWSYS_USE_Directory 1)
66 SET(KWSYS_USE_RegularExpression 1)
67 SET(KWSYS_USE_Base64 1)
68 SET(KWSYS_USE_MD5 1)
69 SET(KWSYS_USE_Process 1)
70 SET(KWSYS_USE_CommandLineArguments 1)
71 SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
72 SUBDIRS(Source/kwsys)
74 #-----------------------------------------------------------------------------
75 # Setup third-party libraries.
77 # Everything in the tree should be able to include files from the
78 # Utilities directory.
79 INCLUDE_DIRECTORIES(
80   ${CMake_SOURCE_DIR}/Utilities
81   ${CMake_BINARY_DIR}/Utilities
82   )
84 # Third party libraries must be something that can be found.
85 IF(EXISTS ${CMAKE_ROOT}/Modules/FindXMLRPC.cmake)
86   SET(CMAKE_ALLOW_SYSTEM_LIBRARIES 1)
87 ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindXMLRPC.cmake)
88   SET(CMAKE_ALLOW_SYSTEM_LIBRARIES 0)
89 ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindXMLRPC.cmake)
91 IF(CMAKE_ALLOW_SYSTEM_LIBRARIES)
92   # Options have dependencies.
93   INCLUDE(CMakeDependentOption)
95   # Allow the user to enable/disable all system utility library options
96   # by setting CMAKE_USE_SYSTEM_LIBRARIES on the command line.
97   IF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
98     SET(CMAKE_USE_SYSTEM_LIBRARIES_USER 1)
99   ENDIF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
100   IF(CMAKE_USE_SYSTEM_LIBRARIES)
101     SET(CMAKE_USE_SYSTEM_LIBRARIES ON)
102   ELSE(CMAKE_USE_SYSTEM_LIBRARIES)
103     SET(CMAKE_USE_SYSTEM_LIBRARIES OFF)
104   ENDIF(CMAKE_USE_SYSTEM_LIBRARIES)
105   IF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
106     SET(CMAKE_USE_SYSTEM_CURL "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed curl" FORCE)
107     SET(CMAKE_USE_SYSTEM_EXPAT "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed expat" FORCE)
108     SET(CMAKE_USE_SYSTEM_XMLRPC "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed xmlrpc" FORCE)
109     SET(CMAKE_USE_SYSTEM_ZLIB "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed zlib" FORCE)
110   ENDIF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
112   # Optionally use system utility libraries.
113   OPTION(CMAKE_USE_SYSTEM_CURL   "Use system-installed curl" ${CMAKE_USE_SYSTEM_LIBRARIES})
114   OPTION(CMAKE_USE_SYSTEM_XMLRPC "Use system-installed xmlrpc" ${CMAKE_USE_SYSTEM_LIBRARIES})
115   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat"
116     ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_XMLRPC" ON)
117   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
118     ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON)
120   # There is currently no option for system tar because the upstream
121   # libtar does not have our modifications to allow reentrant
122   # object-oriented use of the library.
123   # OPTION(CMAKE_USE_SYSTEM_TAR    "Use system-installed tar"   OFF)
124 ELSE(CMAKE_ALLOW_SYSTEM_LIBRARIES)
125   SET(CMAKE_USE_SYSTEM_CURL 0)
126   SET(CMAKE_USE_SYSTEM_EXPAT 0)
127   SET(CMAKE_USE_SYSTEM_XMLRPC 0)
128   SET(CMAKE_USE_SYSTEM_ZLIB 0)
129 ENDIF(CMAKE_ALLOW_SYSTEM_LIBRARIES)
131 # Inform utility library header wrappers whether to use system versions.
132 CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in
133                ${CMake_BINARY_DIR}/Utilities/cmThirdParty.h
134                @ONLY IMMEDIATE)
136 # Mention to the user what system libraries are being used.
137 FOREACH(util CURL EXPAT XMLRPC ZLIB)
138   IF(CMAKE_USE_SYSTEM_${util})
139     MESSAGE(STATUS "Using system-installed ${util}")
140   ENDIF(CMAKE_USE_SYSTEM_${util})
141 ENDFOREACH(util)
143 #-----------------------------------------------------------------------------
144 # Build zlib library for Curl, CMake, and CTest.
145 SET(CMAKE_ZLIB_HEADER "cm_zlib.h")
146 IF(CMAKE_USE_SYSTEM_ZLIB)
147   FIND_PACKAGE(ZLIB)
148   IF(NOT ZLIB_FOUND)
149     MESSAGE(FATAL_ERROR "CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!")
150   ENDIF(NOT ZLIB_FOUND)
151   SET(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR})
152   SET(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
153 ELSE(CMAKE_USE_SYSTEM_ZLIB)
154   SUBDIRS(Utilities/cmzlib)
155   SET(CMAKE_ZLIB_INCLUDES)
156   SET(CMAKE_ZLIB_LIBRARIES cmzlib)
157 ENDIF(CMAKE_USE_SYSTEM_ZLIB)
159 #-----------------------------------------------------------------------------
160 # Build Curl library for CTest.
161 IF(CMAKE_USE_SYSTEM_CURL)
162   FIND_PACKAGE(CURL)
163   IF(NOT CURL_FOUND)
164     MESSAGE(FATAL_ERROR "CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!")
165   ENDIF(NOT CURL_FOUND)
166   SET(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS})
167   SET(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES})
168 ELSE(CMAKE_USE_SYSTEM_CURL)
169   SET(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER})
170   SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
171   SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
172   ADD_DEFINITIONS(-DCURL_STATICLIB)
173   SUBDIRS(Utilities/cmcurl)
174   SET(CMAKE_CURL_INCLUDES)
175   SET(CMAKE_CURL_LIBRARIES cmcurl)
176 ENDIF(CMAKE_USE_SYSTEM_CURL)
178 #-----------------------------------------------------------------------------
179 # Build Tar library for CTest.
180 SET(CMTAR_ZLIB_HEADER ${CMAKE_ZLIB_HEADER})
181 SET(CMTAR_ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES})
182 SET(CMTAR_ZLIB_INCLUDE_DIRS ${CMAKE_ZLIB_INCLUDES})
183 SUBDIRS(Utilities/cmtar)
184 SET(CMAKE_TAR_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar)
185 SET(CMAKE_TAR_LIBRARIES cmtar)
187 #-----------------------------------------------------------------------------
188 # Build Compress library for CTest.
189 SUBDIRS(Utilities/cmcompress)
190 SET(CMAKE_COMPRESS_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
191 SET(CMAKE_COMPRESS_LIBRARIES "cmcompress")
193 #-----------------------------------------------------------------------------
194 # Build expat library for CMake and CTest.
195 IF(CMAKE_USE_SYSTEM_EXPAT)
196   FIND_PACKAGE(EXPAT)
197   IF(NOT EXPAT_FOUND)
198     MESSAGE(FATAL_ERROR
199       "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
200   ENDIF(NOT EXPAT_FOUND)
201   SET(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
202   SET(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
203 ELSE(CMAKE_USE_SYSTEM_EXPAT)
204   SUBDIRS(Utilities/cmexpat)
205   SET(CMAKE_EXPAT_INCLUDES)
206   SET(CMAKE_EXPAT_LIBRARIES cmexpat)
207 ENDIF(CMAKE_USE_SYSTEM_EXPAT)
209 IF(CMAKE_USE_SYSTEM_XMLRPC)
210   FIND_PACKAGE(XMLRPC QUIET REQUIRED libwww-client)
211   IF(NOT XMLRPC_FOUND)
212     MESSAGE(FATAL_ERROR
213       "CMAKE_USE_SYSTEM_XMLRPC is ON but a xmlrpc is not found!")
214   ENDIF(NOT XMLRPC_FOUND)
215   SET(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS})
216   SET(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES})
217 ELSE(CMAKE_USE_SYSTEM_XMLRPC)
218   SUBDIRS(Utilities/cmxmlrpc)
219   SET(CMAKE_XMLRPC_INCLUDES)
220   SET(CMAKE_XMLRPC_LIBRARIES cmXMLRPC)
221 ENDIF(CMAKE_USE_SYSTEM_XMLRPC)
223 IF (UNIX)
224   FIND_PACKAGE(Curses QUIET)
225   IF (CURSES_LIBRARY)
226     OPTION(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
227   ELSE (CURSES_LIBRARY)
228     MESSAGE("Curses libraries were not found. Curses GUI for CMake will not be build.")
229     SET(BUILD_CursesDialog 0)
230   ENDIF (CURSES_LIBRARY)
231 ELSE (UNIX)
232   SET(BUILD_CursesDialog 0)
233 ENDIF (UNIX)
235 IF(BUILD_CursesDialog)
236   SUBDIRS(Source/CursesDialog/form)
237 ENDIF(BUILD_CursesDialog)
239 INCLUDE(CheckSymbolExists)
240 CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
241 CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
243 SUBDIRS(Source Modules Templates Utilities Tests/CMakeTests)
244 ENABLE_TESTING()
246 # Include the standard Dart testing module
247 #SET(DART_ROOT "" CACHE INTERNAL "" FORCE)
248 INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
250 # use the ansi CXX compile flag for building cmake
252 IF (CMAKE_ANSI_CXXFLAGS)
253   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")  
254 ENDIF (CMAKE_ANSI_CXXFLAGS)
256 IF (CMAKE_ANSI_CFLAGS)
257   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")  
258 ENDIF (CMAKE_ANSI_CFLAGS)
260 # add some testing dependencies
261 IF(BUILD_TESTING)
262   IF (DART_ROOT)
263     CONFIGURE_FILE(${CMake_SOURCE_DIR}/CMakeLogo.gif ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
264   ENDIF (DART_ROOT)
265 ENDIF(BUILD_TESTING)
266 MARK_AS_ADVANCED(DART_ROOT)
267 MARK_AS_ADVANCED(CURL_TESTING)
269 SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/bin CACHE INTERNAL 
270   "Where to put the executables for CMake"
271   )
272 SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL 
273   "Where to put the libraries for CMake"
274   )
276 INCLUDE_REGULAR_EXPRESSION("^.*$")
278 CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
279   ${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
280 CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
281   ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
283 CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.ctest.in
284   ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
286 SET(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
287 IF(WIN32)
288   IF(NOT UNIX)
289     IF(NOT BORLAND)
290       IF(NOT MINGW )
291         SET(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
292       ENDIF(NOT MINGW )
293     ENDIF(NOT BORLAND)
294   ENDIF(NOT UNIX)
295 ENDIF(WIN32)
296 IF(CMAKE_BUILD_ON_VISUAL_STUDIO)
297   IF("CMake_HAVE_MFC" MATCHES "^CMake_HAVE_MFC$")
298     SET(CHECK_INCLUDE_FILE_VAR "afxwin.h")
299     CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
300       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
301     MESSAGE(STATUS "Looking for MFC")
302     TRY_COMPILE(CMake_HAVE_MFC
303       ${CMAKE_BINARY_DIR}
304       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
305       CMAKE_FLAGS
306       -DCMAKE_MFC_FLAG:STRING=2
307       -DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
308       OUTPUT_VARIABLE OUTPUT)
309     IF(CMake_HAVE_MFC)
310       MESSAGE(STATUS "Looking for MFC - found")
311       SET(CMake_HAVE_MFC 1 CACHE INTERNAL "Have MFC?")
312       FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
313         "Determining if MFC exists passed with the following output:\n"
314         "${OUTPUT}\n\n")
315     ELSE(CMake_HAVE_MFC)
316       MESSAGE(STATUS "Looking for MFC - not found")
317       SET(CMake_HAVE_MFC 0 CACHE INTERNAL "Have MFC?")
318       FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
319         "Determining if MFC exists failed with the following output:\n"
320         "${OUTPUT}\n\n")
321     ENDIF(CMake_HAVE_MFC)
322   ENDIF("CMake_HAVE_MFC" MATCHES "^CMake_HAVE_MFC$")
324   IF(CMake_HAVE_MFC)
325     OPTION(BUILD_MFCDialog "Whether to build the CMakeSetup MFC dialog." ON)
326   ELSE(CMake_HAVE_MFC)
327     SET(BUILD_MFCDialog 0)
328   ENDIF(CMake_HAVE_MFC)
329 ELSE(CMAKE_BUILD_ON_VISUAL_STUDIO)
330   SET(BUILD_MFCDialog 0)
331 ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO)
333 CONFIGURE_FILE(
334   "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
335   "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
336   IMMEDIATE @ONLY)
338 ADD_CUSTOM_TARGET(uninstall
339   "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
341 # include support for making the release
342 INCLUDE (${CMake_SOURCE_DIR}/Utilities/Release/Release.cmake)
344 # If the cmake version includes cpack, use it
345 IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
346   IF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
347     SET(CMAKE_INSTALL_MFC_LIBRARIES 1)
348     INCLUDE(InstallRequiredSystemLibraries)
349   ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
350   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
351   SET(CPACK_PACKAGE_VENDOR "Kitware")
352   SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
353   SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
354   SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}")
355   SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}")
356   SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}")
357   SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
358   SET(CPACK_SOURCE_PACKAGE_FILE_NAME
359     "cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
360   IF(CMake_VERSION_RC)
361     SET(CPACK_SOURCE_PACKAGE_FILE_NAME
362       "${CPACK_SOURCE_PACKAGE_FILE_NAME}-RC-${CMake_VERSION_RC}")
363   ENDIF(CMake_VERSION_RC)
364   IF(NOT DEFINED CPACK_SYSTEM_NAME)
365     SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
366   ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
367   IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
368     IF(CMAKE_CL_64)
369       SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
370     ELSE(CMAKE_CL_64)
371       SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
372     ENDIF(CMAKE_CL_64)
373   ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
374   IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
375     SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
376   ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
377   IF(WIN32 AND NOT UNIX)
378     # There is a bug in NSI that does not handle full unix paths properly. Make
379     # sure there is at least one set of four (4) backlasshes.
380     SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp")
381     SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake")
382     SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\CMakeSetup.exe")
383     SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} a cross-platform, open-source build system")
384     SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.cmake.org")
385     SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.kitware.com")
386     SET(CPACK_NSIS_CONTACT "cmake@cmake.org")
387     SET(CPACK_NSIS_MODIFY_PATH ON)
388   ELSE(WIN32 AND NOT UNIX)
389     SET(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest")
390     SET(CPACK_SOURCE_STRIP_FILES "")
391     SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
392   ENDIF(WIN32 AND NOT UNIX)
393 # cygwin specific packaging stuff
394   IF(CYGWIN)
395     SET(CPACK_PACKAGE_NAME cmake)
396     # setup the name of the package for cygwin cmake-2.4.3
397     SET(CPACK_PACKAGE_FILE_NAME
398       "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
399     # the source has the same name as the binary
400     SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
401     # Create a cygwin version number in case there are changes for cygwin
402     # that are not reflected upstream in CMake
403     SET(CPACK_CYGWIN_PATCH_NUMBER 1)
404     # if we are on cygwin and have cpack, then force the 
405     # doc, data and man dirs to conform to cygwin style directories
406     SET(CMAKE_DOC_DIR "/share/doc/${CPACK_PACKAGE_FILE_NAME}")
407     SET(CMAKE_DATA_DIR "/share/${CPACK_PACKAGE_FILE_NAME}")
408     SET(CMAKE_MAN_DIR "/share/man")
409     # let the user know we just forced these values
410     MESSAGE(STATUS "Setup for Cygwin packaging")
411     MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}")
412     MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}")
413     MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}")
414     # These files are required by the cmCPackCygwinSourceGenerator and the files
415     # put into the release tar files.
416     SET(CPACK_CYGWIN_BUILD_SCRIPT 
417       "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh")
418     SET(CPACK_CYGWIN_PATCH_FILE 
419       "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch")
420     # include the sub directory for cygwin releases
421     SUBDIRS(Utilities/Release/Cygwin)
422     # when packaging source make sure the .build directory is not included
423     SET(CPACK_SOURCE_IGNORE_FILES
424       "/CVS/" "/\\\\.build/" "/\\\\.svn/" "\\\\.swp$" "\\\\.#" "/#" "~$")
425   ENDIF(CYGWIN)
426   # include CPack model once all variables are set
427   INCLUDE(CPack)
428 ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
430 # configure the CTestScript.cmake file into the binary directory
431 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
432   "${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
433   @ONLY IMMEDIATE)
435 # Testing
436 IF (NOT DART_ROOT)
437   SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
438 ENDIF (NOT DART_ROOT)
440 IF(BUILD_TESTING)
441   SET(CMAKE_TEST_GENERATOR "" CACHE STRING "Generator used when running tests")
442   SET(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH "Generator used when running tests")
443   IF(NOT CMAKE_TEST_GENERATOR)
444     SET(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
445     SET(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}")
446   ELSE(NOT CMAKE_TEST_GENERATOR)
447     SET(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
448   ENDIF(NOT CMAKE_TEST_GENERATOR)
450   # Are we testing with the MSVC compiler?
451   SET(CMAKE_TEST_MSVC 0)
452   IF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
453     SET(CMAKE_TEST_MSVC 1)
454   ELSE(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
455     IF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
456         "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
457       SET(CMAKE_TEST_MSVC 1)
458     ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
459       "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
460   ENDIF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
462   SET(CMAKE_TEST_SYSTEM_LIBRARIES 0)
463   FOREACH(util CURL EXPAT XMLRPC ZLIB)
464     IF(CMAKE_USE_SYSTEM_${util})
465       SET(CMAKE_TEST_SYSTEM_LIBRARIES 1)
466     ENDIF(CMAKE_USE_SYSTEM_${util})
467   ENDFOREACH(util)
469   # This variable is set by cmake, however to
470   # test cmake we want to make sure that
471   # the ctest from this cmake is used for testing
472   # and not the ctest from the cmake building and testing
473   # cmake.
474   SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
475   SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake")
476 ENDIF(BUILD_TESTING)
478 ADD_TEST(SystemInformationNew 
479   "${CMAKE_CMAKE_COMMAND}" --system-information
480   -G "${CMAKE_TEST_GENERATOR}"
481   )