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