ENH: use .exe on vms
[cmake.git] / CMakeLists.txt
blobb1ca6fb8850bee8a460de99af75b7cdda402ff20
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR)
2 PROJECT(CMake)
3 IF(COMMAND CMAKE_POLICY)
4   CMAKE_POLICY(SET CMP0003 NEW)
5 ENDIF(COMMAND CMAKE_POLICY)
7 MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
11 #-----------------------------------------------------------------------
12 # a macro to deal with system libraries, implemented as a macro
13 # simply to improve readability of the main script
14 #-----------------------------------------------------------------------
15 MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES)
16   # Options have dependencies.
17   INCLUDE(CMakeDependentOption)
19   # Optionally use system xmlrpc.  We no longer build or use it by default.
20   OPTION(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF)
21   MARK_AS_ADVANCED(CTEST_USE_XMLRPC)
23   # Allow the user to enable/disable all system utility library options
24   # by setting CMAKE_USE_SYSTEM_LIBRARIES on the command line.
25   IF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
26     SET(CMAKE_USE_SYSTEM_LIBRARIES_USER 1)
27   ENDIF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
28   IF(CMAKE_USE_SYSTEM_LIBRARIES)
29     SET(CMAKE_USE_SYSTEM_LIBRARIES ON)
30   ELSE(CMAKE_USE_SYSTEM_LIBRARIES)
31     SET(CMAKE_USE_SYSTEM_LIBRARIES OFF)
32   ENDIF(CMAKE_USE_SYSTEM_LIBRARIES)
33   IF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
34     SET(CMAKE_USE_SYSTEM_CURL "${CMAKE_USE_SYSTEM_LIBRARIES}"
35       CACHE BOOL "Use system-installed curl" FORCE)
36     SET(CMAKE_USE_SYSTEM_EXPAT "${CMAKE_USE_SYSTEM_LIBRARIES}"
37       CACHE BOOL "Use system-installed expat" FORCE)
38     SET(CMAKE_USE_SYSTEM_ZLIB "${CMAKE_USE_SYSTEM_LIBRARIES}"
39       CACHE BOOL "Use system-installed zlib" FORCE)
40   ENDIF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
42   # Optionally use system utility libraries.
43   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl"
44     ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON)
45   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat"
46     ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON)
47   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
48     ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON)
50   # There is currently no option for system tar because the upstream
51   # libtar does not have our modifications to allow reentrant
52   # object-oriented use of the library.
53   # OPTION(CMAKE_USE_SYSTEM_TAR    "Use system-installed tar"   OFF)
55   # Mention to the user what system libraries are being used.
56   FOREACH(util CURL EXPAT XMLRPC ZLIB)
57     IF(CMAKE_USE_SYSTEM_${util})
58       MESSAGE(STATUS "Using system-installed ${util}")
59     ENDIF(CMAKE_USE_SYSTEM_${util})
60   ENDFOREACH(util)
62   # Inform utility library header wrappers whether to use system versions.
63   CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in
64     ${CMake_BINARY_DIR}/Utilities/cmThirdParty.h
65     @ONLY)
67 ENDMACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES)
71 #-----------------------------------------------------------------------
72 # a macro to check for MFC and setup to build the MFC Dialog
73 # simply to improve readability of the main script
74 #-----------------------------------------------------------------------
75 MACRO(CMAKE_TEST_FOR_MFC)
76   SET(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
77   IF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW )
78     SET(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
79   ENDIF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW )
80   
81   IF(CMAKE_BUILD_ON_VISUAL_STUDIO)
82     IF("CMake_HAVE_MFC" MATCHES "^CMake_HAVE_MFC$")
83       SET(CHECK_INCLUDE_FILE_VAR "afxwin.h")
84       CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
85         ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
86       MESSAGE(STATUS "Looking for MFC")
87       TRY_COMPILE(CMake_HAVE_MFC
88         ${CMAKE_BINARY_DIR}
89         ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
90         CMAKE_FLAGS
91         -DCMAKE_MFC_FLAG:STRING=2
92         -DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
93         OUTPUT_VARIABLE OUTPUT)
94       IF(CMake_HAVE_MFC)
95         MESSAGE(STATUS "Looking for MFC - found")
96         SET(CMake_HAVE_MFC 1 CACHE INTERNAL "Have MFC?")
97         FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
98           "Determining if MFC exists passed with the following output:\n"
99           "${OUTPUT}\n\n")
100       ELSE(CMake_HAVE_MFC)
101         MESSAGE(STATUS "Looking for MFC - not found")
102         SET(CMake_HAVE_MFC 0 CACHE INTERNAL "Have MFC?")
103         FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
104           "Determining if MFC exists failed with the following output:\n"
105           "${OUTPUT}\n\n")
106       ENDIF(CMake_HAVE_MFC)
107     ENDIF("CMake_HAVE_MFC" MATCHES "^CMake_HAVE_MFC$")
108     
109     IF(CMake_HAVE_MFC)
110       OPTION(BUILD_MFCDialog "Whether to build the CMakeSetup MFC dialog." ON)
111     ELSE(CMake_HAVE_MFC)
112       SET(BUILD_MFCDialog 0)
113     ENDIF(CMake_HAVE_MFC)
114   ELSE(CMAKE_BUILD_ON_VISUAL_STUDIO)
115     SET(BUILD_MFCDialog 0)
116   ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO)
117 ENDMACRO(CMAKE_TEST_FOR_MFC)
121 #-----------------------------------------------------------------------
122 # a macro to determine the generator and ctest executable to use
123 # for testing. Simply to improve readability of the main script.
124 #-----------------------------------------------------------------------
125 MACRO(CMAKE_SETUP_TESTING)
126   IF (NOT DART_ROOT)
127     SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
128   ENDIF (NOT DART_ROOT)
129   
130   IF(BUILD_TESTING)
131     SET(CMAKE_TEST_GENERATOR "" CACHE STRING 
132       "Generator used when running tests")
133     SET(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH 
134       "Generator used when running tests")
135     IF(NOT CMAKE_TEST_GENERATOR)
136       SET(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
137       SET(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}")
138     ELSE(NOT CMAKE_TEST_GENERATOR)
139       SET(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
140     ENDIF(NOT CMAKE_TEST_GENERATOR)
141     
142     # Are we testing with the MSVC compiler?
143     SET(CMAKE_TEST_MSVC 0)
144     IF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
145       SET(CMAKE_TEST_MSVC 1)
146     ELSE(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
147       IF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
148           "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
149         SET(CMAKE_TEST_MSVC 1)
150       ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
151         "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
152     ENDIF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
153     
154     SET(CMAKE_TEST_SYSTEM_LIBRARIES 0)
155     FOREACH(util CURL EXPAT XMLRPC ZLIB)
156       IF(CMAKE_USE_SYSTEM_${util})
157         SET(CMAKE_TEST_SYSTEM_LIBRARIES 1)
158       ENDIF(CMAKE_USE_SYSTEM_${util})
159     ENDFOREACH(util)
160     
161     # This variable is set by cmake, however to
162     # test cmake we want to make sure that
163     # the ctest from this cmake is used for testing
164     # and not the ctest from the cmake building and testing
165     # cmake.
166     SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
167     SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake")
168   ENDIF(BUILD_TESTING)
170   # configure some files for testing
171   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
172     "${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
173     @ONLY)  
174   CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
175     ${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
176   CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
177     ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
178   CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
179     ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
180   CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.ctest.in
181     ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
182   IF(BUILD_TESTING AND DART_ROOT)
183     CONFIGURE_FILE(${CMake_SOURCE_DIR}/CMakeLogo.gif 
184       ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
185   ENDIF(BUILD_TESTING AND DART_ROOT)
186   MARK_AS_ADVANCED(DART_ROOT)
187   MARK_AS_ADVANCED(CURL_TESTING)
188 ENDMACRO(CMAKE_SETUP_TESTING)
192 #-----------------------------------------------------------------------
193 # a macro to build the utilities used by CMake
194 # Simply to improve readability of the main script.
195 #-----------------------------------------------------------------------
196 MACRO (CMAKE_BUILD_UTILITIES)
197   #---------------------------------------------------------------------
198   # Create the kwsys library for CMake.
199   SET(KWSYS_NAMESPACE cmsys)
200   SET(KWSYS_USE_SystemTools 1)
201   SET(KWSYS_USE_Directory 1)
202   SET(KWSYS_USE_RegularExpression 1)
203   SET(KWSYS_USE_Base64 1)
204   SET(KWSYS_USE_MD5 1)
205   SET(KWSYS_USE_Process 1)
206   SET(KWSYS_USE_CommandLineArguments 1)
207   SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
208   SUBDIRS(Source/kwsys)
209   
210   #---------------------------------------------------------------------
211   # Setup third-party libraries.
212   # Everything in the tree should be able to include files from the
213   # Utilities directory.
214   INCLUDE_DIRECTORIES(
215     ${CMake_BINARY_DIR}/Utilities
216     ${CMake_SOURCE_DIR}/Utilities
217     )
218   
219   # check for the use of system libraries versus builtin ones
220   # (a macro defined in this file)
221   CMAKE_HANDLE_SYSTEM_LIBRARIES()
222   
223   #---------------------------------------------------------------------
224   # Build zlib library for Curl, CMake, and CTest.
225   SET(CMAKE_ZLIB_HEADER "cm_zlib.h")
226   IF(CMAKE_USE_SYSTEM_ZLIB)
227     FIND_PACKAGE(ZLIB)
228     IF(NOT ZLIB_FOUND)
229       MESSAGE(FATAL_ERROR 
230         "CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!")
231     ENDIF(NOT ZLIB_FOUND)
232     SET(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR})
233     SET(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
234   ELSE(CMAKE_USE_SYSTEM_ZLIB)
235     SET(CMAKE_ZLIB_INCLUDES)
236     SET(CMAKE_ZLIB_LIBRARIES cmzlib)
237     SUBDIRS(Utilities/cmzlib)
238   ENDIF(CMAKE_USE_SYSTEM_ZLIB)
239   
240   #---------------------------------------------------------------------
241   # Build Curl library for CTest.
242   IF(CMAKE_USE_SYSTEM_CURL)
243     FIND_PACKAGE(CURL)
244     IF(NOT CURL_FOUND)
245       MESSAGE(FATAL_ERROR 
246         "CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!")
247     ENDIF(NOT CURL_FOUND)
248     SET(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS})
249     SET(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES})
250   ELSE(CMAKE_USE_SYSTEM_CURL)
251     SET(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER})
252     SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
253     SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
254     OPTION(CMAKE_BUILD_CURL_SHARED "Should curl be built shared" FALSE)
255     IF(NOT CMAKE_BUILD_CURL_SHARED)
256       ADD_DEFINITIONS(-DCURL_STATICLIB)
257     ENDIF(NOT CMAKE_BUILD_CURL_SHARED)
258     SET(CMAKE_CURL_INCLUDES)
259     SET(CMAKE_CURL_LIBRARIES cmcurl)
260     SUBDIRS(Utilities/cmcurl)
261   ENDIF(CMAKE_USE_SYSTEM_CURL)
263   #---------------------------------------------------------------------
264   # Build Tar library for CTest.
265   SET(CMTAR_ZLIB_HEADER ${CMAKE_ZLIB_HEADER})
266   SET(CMTAR_ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES})
267   SET(CMTAR_ZLIB_INCLUDE_DIRS ${CMAKE_ZLIB_INCLUDES})
268   SET(CMAKE_TAR_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar)
269   SET(CMAKE_TAR_LIBRARIES cmtar)
270   SUBDIRS(Utilities/cmtar)
271   
272   #---------------------------------------------------------------------
273   # Build Compress library for CTest.
274   SET(CMAKE_COMPRESS_INCLUDES 
275     "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
276   SET(CMAKE_COMPRESS_LIBRARIES "cmcompress")
277   SUBDIRS(Utilities/cmcompress)
278   
279   #---------------------------------------------------------------------
280   # Build expat library for CMake and CTest.
281   IF(CMAKE_USE_SYSTEM_EXPAT)
282     FIND_PACKAGE(EXPAT)
283     IF(NOT EXPAT_FOUND)
284       MESSAGE(FATAL_ERROR
285         "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
286     ENDIF(NOT EXPAT_FOUND)
287     SET(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
288     SET(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
289   ELSE(CMAKE_USE_SYSTEM_EXPAT)
290     SET(CMAKE_EXPAT_INCLUDES)
291     SET(CMAKE_EXPAT_LIBRARIES cmexpat)
292     SUBDIRS(Utilities/cmexpat)
293   ENDIF(CMAKE_USE_SYSTEM_EXPAT)
294   
295   #---------------------------------------------------------------------
296   # Build XMLRPC library for CMake and CTest.
297   IF(CTEST_USE_XMLRPC)
298     FIND_PACKAGE(XMLRPC QUIET REQUIRED libwww-client)
299     IF(NOT XMLRPC_FOUND)
300       MESSAGE(FATAL_ERROR
301         "CTEST_USE_XMLRPC is ON but xmlrpc is not found!")
302     ENDIF(NOT XMLRPC_FOUND)
303     SET(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS})
304     SET(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES})
305   ENDIF(CTEST_USE_XMLRPC)
306   
307   #---------------------------------------------------------------------
308   # Use curses?
309   IF (UNIX)
310     # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex
311     IF(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable)
312       SET(CURSES_NEED_NCURSES TRUE)
313       FIND_PACKAGE(Curses QUIET)
314       IF (CURSES_LIBRARY)
315         OPTION(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
316       ELSE (CURSES_LIBRARY)
317         MESSAGE("Curses libraries were not found. Curses GUI for CMake will not be built.")
318         SET(BUILD_CursesDialog 0)
319       ENDIF (CURSES_LIBRARY)
320     ELSE(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable)
321       SET(BUILD_CursesDialog 0)
322     ENDIF(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable)
323   ELSE (UNIX)
324     SET(BUILD_CursesDialog 0)
325   ENDIF (UNIX)
326   IF(BUILD_CursesDialog)
327     SUBDIRS(Source/CursesDialog/form)
328   ENDIF(BUILD_CursesDialog)
329 ENDMACRO (CMAKE_BUILD_UTILITIES)
333 #-----------------------------------------------------------------------
334 # The main section of the CMakeLists file
336 #-----------------------------------------------------------------------
337 # The CMake version number.
338 SET(CMake_VERSION_MAJOR 2)
339 SET(CMake_VERSION_MINOR 7)
340 SET(CMake_VERSION_PATCH 0)
342 # We use odd minor numbers for development versions.
343 # Use a date for the development patch level.
344 IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
345   INCLUDE(${CMake_SOURCE_DIR}/Source/kwsys/kwsysDateStamp.cmake)
346   SET(CMake_VERSION_PATCH
347     "${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}"
348     )
349 ENDIF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
351 SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
352 SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
354 # Include the standard Dart testing module
355 ENABLE_TESTING()
356 INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
358 # where to write the resulting executables and libraries
359 SET(BUILD_SHARED_LIBS OFF)
360 SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/bin CACHE INTERNAL 
361   "Where to put the executables for CMake")
362 SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL 
363   "Where to put the libraries for CMake")
364 INCLUDE_REGULAR_EXPRESSION("^.*$")
366 # The CMake executables usually do not need any rpath to run in the build or
367 # install tree.
368 SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
370 SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}" CACHE STRING
371   "Install location for data (relative to prefix).")
372 SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION}" CACHE STRING
373   "Install location for documentation (relative to prefix).")
374 SET(CMAKE_MAN_DIR "/man" CACHE STRING
375   "Install location for man pages (relative to prefix).")
376 MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
378 # include special compile flags for some compilers
379 INCLUDE(CompileFlags.cmake)
381 # no clue why we are testing for this here
382 INCLUDE(CheckSymbolExists)
383 CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
384 CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
386 # build the utilities (a macro defined in this file) 
387 CMAKE_BUILD_UTILITIES()
389 # On NetBSD ncurses is required, since curses doesn't have the wsyncup()
390 # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
391 # which isn't in the default linker search path. So without RPATH ccmake 
392 # doesn't run and the build doesn't succeed since ccmake is executed for
393 # generating the documentation.
394 IF(BUILD_CursesDialog)
395   GET_FILENAME_COMPONENT(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
396   SET(CURSES_NEED_RPATH FALSE)
397   IF(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
398     SET(CURSES_NEED_RPATH TRUE)
399   ENDIF(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
400 ENDIF(BUILD_CursesDialog)
402 IF(BUILD_QtDialog)
403   IF(APPLE)
404     SET(CMAKE_BUNDLE_NAME
405       "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_PATCH}")
406     SET(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
407     # make sure CMAKE_INSTALL_PREFIX ends in /
408     STRING(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
409     MATH(EXPR LEN "${LEN} -1" )
410     STRING(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
411     IF(NOT "${ENDCH}" STREQUAL "/")
412       SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
413     ENDIF(NOT "${ENDCH}" STREQUAL "/")
414     SET(CMAKE_INSTALL_PREFIX 
415       "${CMAKE_INSTALL_PREFIX}${CMAKE_BUNDLE_NAME}.app/Contents")
416   ENDIF(APPLE)
417   
418   SET(QT_NEED_RPATH FALSE)
419   IF(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
420     SET(QT_NEED_RPATH TRUE)
421   ENDIF(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
422 ENDIF(BUILD_QtDialog)
425 # The same might be true on other systems for other libraries.
426 # Then only enable RPATH if we have are building at least with cmake 2.4, 
427 # since this one has much better RPATH features than cmake 2.2.
428 # The executables are then built with the RPATH for the libraries outside
429 # the build tree, which is both the build and the install RPATH.
430 IF (UNIX)
431   IF(   CMAKE_USE_SYSTEM_CURL   OR  CMAKE_USE_SYSTEM_ZLIB
432         OR  CMAKE_USE_SYSTEM_EXPAT  OR  CTEST_USE_XMLRPC  OR  CURSES_NEED_RPATH  OR  QT_NEED_RPATH)
433     SET(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
434     SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
435     SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
436   ENDIF(CMAKE_USE_SYSTEM_CURL   OR  CMAKE_USE_SYSTEM_ZLIB
437         OR  CMAKE_USE_SYSTEM_EXPAT  OR  CTEST_USE_XMLRPC  OR  CURSES_NEED_RPATH  OR  QT_NEED_RPATH)
438 ENDIF (UNIX)
441 # should we build the MFC dialog? (a macro defined in this file)
442 CMAKE_TEST_FOR_MFC()
444 # add the uninstall support
445 CONFIGURE_FILE(
446   "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
447   "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
448   @ONLY)
449 ADD_CUSTOM_TARGET(uninstall
450   "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
452 INCLUDE (CMakeCPack.cmake)
454 # setup some Testing support (a macro defined in this file)
455 CMAKE_SETUP_TESTING()
456 CONFIGURE_FILE(
457   "${CMAKE_CURRENT_SOURCE_DIR}/DartLocal.conf.in"
458   "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf"
459   COPYONLY)
461 OPTION(CMAKE_STRICT   
462   "Perform strict testing to record property and variable access. Can be used to report any undefined properties or variables" OFF)
463 MARK_AS_ADVANCED(CMAKE_STRICT)
466 # build the remaining subdirectories
467 SUBDIRS(Source)
468 SUBDIRS(Modules)
469 SUBDIRS(Templates)
470 SUBDIRS(Utilities)
471 SUBDIRS(Tests)
473 # add a test
474 ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" 
475   --system-information  -G "${CMAKE_TEST_GENERATOR}" )
477 #-----------------------------------------------------------------------
478 # End of the main section of the CMakeLists file
479 #-----------------------------------------------------------------------