CMakeLists.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. #=============================================================================
  2. # CMake - Cross Platform Makefile Generator
  3. # Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. #
  5. # Distributed under the OSI-approved BSD License (the "License");
  6. # see accompanying file Copyright.txt for details.
  7. #
  8. # This software is distributed WITHOUT ANY WARRANTY; without even the
  9. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. # See the License for more information.
  11. #=============================================================================
  12. CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR)
  13. PROJECT(CMake)
  14. IF(COMMAND CMAKE_POLICY)
  15. CMAKE_POLICY(SET CMP0003 NEW)
  16. ENDIF(COMMAND CMAKE_POLICY)
  17. MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
  18. # Allow empty endif() and such with CMake 2.4.
  19. SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1)
  20. IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
  21. # Since the built CMake will install itself instead of the
  22. # generating CMake, tell it that the install rules were generated
  23. # by CMake 2.4.
  24. INSTALL(CODE "SET(CMAKE_INSTALL_SELF_2_4 1)")
  25. ENDIF()
  26. #-----------------------------------------------------------------------
  27. # a macro to deal with system libraries, implemented as a macro
  28. # simply to improve readability of the main script
  29. #-----------------------------------------------------------------------
  30. MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES)
  31. # Options have dependencies.
  32. INCLUDE(CMakeDependentOption)
  33. # Optionally use system xmlrpc. We no longer build or use it by default.
  34. OPTION(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF)
  35. MARK_AS_ADVANCED(CTEST_USE_XMLRPC)
  36. # Allow the user to enable/disable all system utility library options
  37. # by setting CMAKE_USE_SYSTEM_LIBRARIES on the command line.
  38. IF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
  39. SET(CMAKE_USE_SYSTEM_LIBRARIES_USER 1)
  40. ENDIF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
  41. IF(CMAKE_USE_SYSTEM_LIBRARIES)
  42. SET(CMAKE_USE_SYSTEM_LIBRARIES ON)
  43. ELSE(CMAKE_USE_SYSTEM_LIBRARIES)
  44. SET(CMAKE_USE_SYSTEM_LIBRARIES OFF)
  45. ENDIF(CMAKE_USE_SYSTEM_LIBRARIES)
  46. IF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
  47. SET(CMAKE_USE_SYSTEM_CURL "${CMAKE_USE_SYSTEM_LIBRARIES}"
  48. CACHE BOOL "Use system-installed curl" FORCE)
  49. SET(CMAKE_USE_SYSTEM_EXPAT "${CMAKE_USE_SYSTEM_LIBRARIES}"
  50. CACHE BOOL "Use system-installed expat" FORCE)
  51. SET(CMAKE_USE_SYSTEM_ZLIB "${CMAKE_USE_SYSTEM_LIBRARIES}"
  52. CACHE BOOL "Use system-installed zlib" FORCE)
  53. ENDIF(CMAKE_USE_SYSTEM_LIBRARIES_USER)
  54. # Optionally use system utility libraries.
  55. CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl"
  56. ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON)
  57. CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat"
  58. ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CTEST_USE_XMLRPC" ON)
  59. CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
  60. ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON)
  61. # There is currently no option for system tar because the upstream
  62. # libtar does not have our modifications to allow reentrant
  63. # object-oriented use of the library.
  64. # OPTION(CMAKE_USE_SYSTEM_TAR "Use system-installed tar" OFF)
  65. # Mention to the user what system libraries are being used.
  66. FOREACH(util CURL EXPAT XMLRPC ZLIB)
  67. IF(CMAKE_USE_SYSTEM_${util})
  68. MESSAGE(STATUS "Using system-installed ${util}")
  69. ENDIF(CMAKE_USE_SYSTEM_${util})
  70. ENDFOREACH(util)
  71. # Inform utility library header wrappers whether to use system versions.
  72. CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in
  73. ${CMake_BINARY_DIR}/Utilities/cmThirdParty.h
  74. @ONLY)
  75. ENDMACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES)
  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. # a macro to determine the generator and ctest executable to use
  82. # for testing. Simply to improve readability of the main script.
  83. #-----------------------------------------------------------------------
  84. MACRO(CMAKE_SETUP_TESTING)
  85. IF (NOT DART_ROOT)
  86. SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
  87. ENDIF (NOT DART_ROOT)
  88. IF(BUILD_TESTING)
  89. SET(CMAKE_TEST_GENERATOR "" CACHE STRING
  90. "Generator used when running tests")
  91. SET(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH
  92. "Generator used when running tests")
  93. IF(NOT CMAKE_TEST_GENERATOR)
  94. SET(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
  95. SET(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}")
  96. ELSE(NOT CMAKE_TEST_GENERATOR)
  97. SET(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
  98. ENDIF(NOT CMAKE_TEST_GENERATOR)
  99. # Are we testing with the MSVC compiler?
  100. SET(CMAKE_TEST_MSVC 0)
  101. IF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
  102. SET(CMAKE_TEST_MSVC 1)
  103. ELSE(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
  104. IF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
  105. "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
  106. SET(CMAKE_TEST_MSVC 1)
  107. ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
  108. "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
  109. ENDIF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
  110. SET(CMAKE_TEST_SYSTEM_LIBRARIES 0)
  111. FOREACH(util CURL EXPAT XMLRPC ZLIB)
  112. IF(CMAKE_USE_SYSTEM_${util})
  113. SET(CMAKE_TEST_SYSTEM_LIBRARIES 1)
  114. ENDIF(CMAKE_USE_SYSTEM_${util})
  115. ENDFOREACH(util)
  116. # This variable is set by cmake, however to
  117. # test cmake we want to make sure that
  118. # the ctest from this cmake is used for testing
  119. # and not the ctest from the cmake building and testing
  120. # cmake.
  121. SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
  122. SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake")
  123. ENDIF(BUILD_TESTING)
  124. # configure some files for testing
  125. CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
  126. "${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
  127. @ONLY)
  128. CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
  129. ${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
  130. CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
  131. ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
  132. CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
  133. ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
  134. CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.ctest.in
  135. ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
  136. IF(BUILD_TESTING AND DART_ROOT)
  137. CONFIGURE_FILE(${CMake_SOURCE_DIR}/CMakeLogo.gif
  138. ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
  139. ENDIF(BUILD_TESTING AND DART_ROOT)
  140. MARK_AS_ADVANCED(DART_ROOT)
  141. MARK_AS_ADVANCED(CURL_TESTING)
  142. ENDMACRO(CMAKE_SETUP_TESTING)
  143. #-----------------------------------------------------------------------
  144. # a macro to build the utilities used by CMake
  145. # Simply to improve readability of the main script.
  146. #-----------------------------------------------------------------------
  147. MACRO (CMAKE_BUILD_UTILITIES)
  148. #---------------------------------------------------------------------
  149. # Create the kwsys library for CMake.
  150. SET(KWSYS_NAMESPACE cmsys)
  151. SET(KWSYS_USE_SystemTools 1)
  152. SET(KWSYS_USE_Directory 1)
  153. SET(KWSYS_USE_RegularExpression 1)
  154. SET(KWSYS_USE_Base64 1)
  155. SET(KWSYS_USE_MD5 1)
  156. SET(KWSYS_USE_Process 1)
  157. SET(KWSYS_USE_CommandLineArguments 1)
  158. SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
  159. SET(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}")
  160. SUBDIRS(Source/kwsys)
  161. #---------------------------------------------------------------------
  162. # Setup third-party libraries.
  163. # Everything in the tree should be able to include files from the
  164. # Utilities directory.
  165. INCLUDE_DIRECTORIES(
  166. ${CMake_BINARY_DIR}/Utilities
  167. ${CMake_SOURCE_DIR}/Utilities
  168. )
  169. # check for the use of system libraries versus builtin ones
  170. # (a macro defined in this file)
  171. CMAKE_HANDLE_SYSTEM_LIBRARIES()
  172. #---------------------------------------------------------------------
  173. # Build zlib library for Curl, CMake, and CTest.
  174. SET(CMAKE_ZLIB_HEADER "cm_zlib.h")
  175. IF(CMAKE_USE_SYSTEM_ZLIB)
  176. FIND_PACKAGE(ZLIB)
  177. IF(NOT ZLIB_FOUND)
  178. MESSAGE(FATAL_ERROR
  179. "CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!")
  180. ENDIF(NOT ZLIB_FOUND)
  181. SET(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR})
  182. SET(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
  183. ELSE(CMAKE_USE_SYSTEM_ZLIB)
  184. SET(CMAKE_ZLIB_INCLUDES)
  185. SET(CMAKE_ZLIB_LIBRARIES cmzlib)
  186. SUBDIRS(Utilities/cmzlib)
  187. ENDIF(CMAKE_USE_SYSTEM_ZLIB)
  188. #---------------------------------------------------------------------
  189. # Build Curl library for CTest.
  190. IF(CMAKE_USE_SYSTEM_CURL)
  191. FIND_PACKAGE(CURL)
  192. IF(NOT CURL_FOUND)
  193. MESSAGE(FATAL_ERROR
  194. "CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!")
  195. ENDIF(NOT CURL_FOUND)
  196. SET(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS})
  197. SET(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES})
  198. ELSE(CMAKE_USE_SYSTEM_CURL)
  199. SET(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER})
  200. SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
  201. SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
  202. OPTION(CMAKE_BUILD_CURL_SHARED "Should curl be built shared" FALSE)
  203. IF(NOT CMAKE_BUILD_CURL_SHARED)
  204. ADD_DEFINITIONS(-DCURL_STATICLIB)
  205. ENDIF(NOT CMAKE_BUILD_CURL_SHARED)
  206. SET(CMAKE_CURL_INCLUDES)
  207. SET(CMAKE_CURL_LIBRARIES cmcurl)
  208. SUBDIRS(Utilities/cmcurl)
  209. ENDIF(CMAKE_USE_SYSTEM_CURL)
  210. #---------------------------------------------------------------------
  211. # Build Tar library for CTest.
  212. SET(CMTAR_ZLIB_HEADER ${CMAKE_ZLIB_HEADER})
  213. SET(CMTAR_ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES})
  214. SET(CMTAR_ZLIB_INCLUDE_DIRS ${CMAKE_ZLIB_INCLUDES})
  215. SET(CMAKE_TAR_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar)
  216. SET(CMAKE_TAR_LIBRARIES cmtar)
  217. SUBDIRS(Utilities/cmtar)
  218. #---------------------------------------------------------------------
  219. # Build Compress library for CTest.
  220. SET(CMAKE_COMPRESS_INCLUDES
  221. "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
  222. SET(CMAKE_COMPRESS_LIBRARIES "cmcompress")
  223. SUBDIRS(Utilities/cmcompress)
  224. #---------------------------------------------------------------------
  225. # Build expat library for CMake and CTest.
  226. IF(CMAKE_USE_SYSTEM_EXPAT)
  227. FIND_PACKAGE(EXPAT)
  228. IF(NOT EXPAT_FOUND)
  229. MESSAGE(FATAL_ERROR
  230. "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!")
  231. ENDIF(NOT EXPAT_FOUND)
  232. SET(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS})
  233. SET(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES})
  234. ELSE(CMAKE_USE_SYSTEM_EXPAT)
  235. SET(CMAKE_EXPAT_INCLUDES)
  236. SET(CMAKE_EXPAT_LIBRARIES cmexpat)
  237. SUBDIRS(Utilities/cmexpat)
  238. ENDIF(CMAKE_USE_SYSTEM_EXPAT)
  239. #---------------------------------------------------------------------
  240. # Build XMLRPC library for CMake and CTest.
  241. IF(CTEST_USE_XMLRPC)
  242. FIND_PACKAGE(XMLRPC QUIET REQUIRED libwww-client)
  243. IF(NOT XMLRPC_FOUND)
  244. MESSAGE(FATAL_ERROR
  245. "CTEST_USE_XMLRPC is ON but xmlrpc is not found!")
  246. ENDIF(NOT XMLRPC_FOUND)
  247. SET(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS})
  248. SET(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES})
  249. ENDIF(CTEST_USE_XMLRPC)
  250. #---------------------------------------------------------------------
  251. # Use curses?
  252. IF (UNIX)
  253. # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex
  254. IF(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable)
  255. SET(CURSES_NEED_NCURSES TRUE)
  256. FIND_PACKAGE(Curses QUIET)
  257. IF (CURSES_LIBRARY)
  258. OPTION(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
  259. ELSE (CURSES_LIBRARY)
  260. MESSAGE("Curses libraries were not found. Curses GUI for CMake will not be built.")
  261. SET(BUILD_CursesDialog 0)
  262. ENDIF (CURSES_LIBRARY)
  263. ELSE(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable)
  264. SET(BUILD_CursesDialog 0)
  265. ENDIF(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable)
  266. ELSE (UNIX)
  267. SET(BUILD_CursesDialog 0)
  268. ENDIF (UNIX)
  269. IF(BUILD_CursesDialog)
  270. SUBDIRS(Source/CursesDialog/form)
  271. ENDIF(BUILD_CursesDialog)
  272. ENDMACRO (CMAKE_BUILD_UTILITIES)
  273. #-----------------------------------------------------------------------
  274. # The main section of the CMakeLists file
  275. #
  276. #-----------------------------------------------------------------------
  277. # The CMake version number.
  278. SET(CMake_VERSION_MAJOR 2)
  279. SET(CMake_VERSION_MINOR 9)
  280. SET(CMake_VERSION_PATCH 0)
  281. # We use odd minor numbers for development versions.
  282. # Use a date for the development patch level.
  283. IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
  284. INCLUDE(${CMake_SOURCE_DIR}/Source/kwsys/kwsysDateStamp.cmake)
  285. SET(CMake_VERSION_PATCH
  286. "${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}"
  287. )
  288. ENDIF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
  289. SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
  290. SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
  291. # Include the standard Dart testing module
  292. ENABLE_TESTING()
  293. INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
  294. # where to write the resulting executables and libraries
  295. SET(BUILD_SHARED_LIBS OFF)
  296. SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/bin CACHE INTERNAL
  297. "Where to put the executables for CMake")
  298. SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
  299. "Where to put the libraries for CMake")
  300. INCLUDE_REGULAR_EXPRESSION("^.*$")
  301. # The CMake executables usually do not need any rpath to run in the build or
  302. # install tree.
  303. SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
  304. SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}" CACHE STRING
  305. "Install location for data (relative to prefix).")
  306. SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION}" CACHE STRING
  307. "Install location for documentation (relative to prefix).")
  308. SET(CMAKE_MAN_DIR "/man" CACHE STRING
  309. "Install location for man pages (relative to prefix).")
  310. MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
  311. STRING(REGEX REPLACE "^/" "" CMake_DATA_DEST "${CMAKE_DATA_DIR}")
  312. STRING(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}")
  313. # include special compile flags for some compilers
  314. INCLUDE(CompileFlags.cmake)
  315. # no clue why we are testing for this here
  316. INCLUDE(CheckSymbolExists)
  317. CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
  318. CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
  319. # build the utilities (a macro defined in this file)
  320. CMAKE_BUILD_UTILITIES()
  321. # On NetBSD ncurses is required, since curses doesn't have the wsyncup()
  322. # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
  323. # which isn't in the default linker search path. So without RPATH ccmake
  324. # doesn't run and the build doesn't succeed since ccmake is executed for
  325. # generating the documentation.
  326. IF(BUILD_CursesDialog)
  327. GET_FILENAME_COMPONENT(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
  328. SET(CURSES_NEED_RPATH FALSE)
  329. 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")
  330. SET(CURSES_NEED_RPATH TRUE)
  331. 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")
  332. ENDIF(BUILD_CursesDialog)
  333. IF(BUILD_QtDialog)
  334. IF(APPLE)
  335. SET(CMAKE_BUNDLE_NAME
  336. "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_PATCH}")
  337. SET(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
  338. # make sure CMAKE_INSTALL_PREFIX ends in /
  339. STRING(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
  340. MATH(EXPR LEN "${LEN} -1" )
  341. STRING(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
  342. IF(NOT "${ENDCH}" STREQUAL "/")
  343. SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
  344. ENDIF(NOT "${ENDCH}" STREQUAL "/")
  345. SET(CMAKE_INSTALL_PREFIX
  346. "${CMAKE_INSTALL_PREFIX}${CMAKE_BUNDLE_NAME}.app/Contents")
  347. ENDIF(APPLE)
  348. SET(QT_NEED_RPATH FALSE)
  349. 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")
  350. SET(QT_NEED_RPATH TRUE)
  351. 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")
  352. ENDIF(BUILD_QtDialog)
  353. # The same might be true on other systems for other libraries.
  354. # Then only enable RPATH if we have are building at least with cmake 2.4,
  355. # since this one has much better RPATH features than cmake 2.2.
  356. # The executables are then built with the RPATH for the libraries outside
  357. # the build tree, which is both the build and the install RPATH.
  358. IF (UNIX)
  359. IF( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB
  360. OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH)
  361. SET(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
  362. SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  363. SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
  364. ENDIF(CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB
  365. OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH)
  366. ENDIF (UNIX)
  367. # add the uninstall support
  368. CONFIGURE_FILE(
  369. "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  370. "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  371. @ONLY)
  372. ADD_CUSTOM_TARGET(uninstall
  373. "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
  374. INCLUDE (CMakeCPack.cmake)
  375. # setup some Testing support (a macro defined in this file)
  376. CMAKE_SETUP_TESTING()
  377. CONFIGURE_FILE(
  378. "${CMAKE_CURRENT_SOURCE_DIR}/DartLocal.conf.in"
  379. "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf"
  380. COPYONLY)
  381. OPTION(CMAKE_STRICT
  382. "Perform strict testing to record property and variable access. Can be used to report any undefined properties or variables" OFF)
  383. MARK_AS_ADVANCED(CMAKE_STRICT)
  384. # build the remaining subdirectories
  385. SUBDIRS(Source)
  386. SUBDIRS(Utilities)
  387. SUBDIRS(Tests)
  388. # add a test
  389. ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
  390. --system-information -G "${CMAKE_TEST_GENERATOR}" )
  391. # Install license file as it requires.
  392. INSTALL(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST})
  393. # Install script directories.
  394. INSTALL(
  395. DIRECTORY Modules Templates
  396. DESTINATION "${CMake_DATA_DEST}"
  397. FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
  398. DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
  399. GROUP_READ GROUP_EXECUTE
  400. WORLD_READ WORLD_EXECUTE
  401. PATTERN "*.sh.in" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
  402. GROUP_READ GROUP_EXECUTE
  403. WORLD_READ WORLD_EXECUTE
  404. PATTERN "CVS" EXCLUDE
  405. )
  406. #-----------------------------------------------------------------------
  407. # End of the main section of the CMakeLists file
  408. #-----------------------------------------------------------------------