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