CMakeLists.txt 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. PROJECT(CMake)
  2. CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
  3. MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
  4. # The CMake version number.
  5. SET(CMake_VERSION_MAJOR 2)
  6. SET(CMake_VERSION_MINOR 3)
  7. SET(CMake_VERSION_PATCH 0)
  8. SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
  9. SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
  10. SET(BUILD_SHARED_LIBS OFF)
  11. SET(CMAKE_DATA_DIR "/share/CMake" CACHE STRING
  12. "Install location for data (relative to prefix).")
  13. SET(CMAKE_DOC_DIR "/doc/CMake" CACHE STRING
  14. "Install location for documentation (relative to prefix).")
  15. SET(CMAKE_MAN_DIR "/man" CACHE STRING
  16. "Install location for man pages (relative to prefix).")
  17. MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
  18. IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
  19. IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
  20. SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
  21. ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
  22. IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
  23. SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
  24. ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
  25. INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
  26. ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
  27. # Disable deprecation warnings for standard C functions.
  28. IF(CMAKE_COMPILER_2005)
  29. ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
  30. ENDIF(CMAKE_COMPILER_2005)
  31. #silence duplicate symbol warnings on AIX
  32. IF(CMAKE_SYSTEM MATCHES "AIX.*")
  33. IF(NOT CMAKE_COMPILER_IS_GNUCXX)
  34. SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
  35. ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
  36. ENDIF(CMAKE_SYSTEM MATCHES "AIX.*")
  37. IF(CMAKE_SYSTEM MATCHES "IRIX.*")
  38. IF(NOT CMAKE_COMPILER_IS_GNUCXX)
  39. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
  40. SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
  41. ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
  42. ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
  43. IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
  44. IF(NOT CMAKE_COMPILER_IS_GNUCXX)
  45. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
  46. ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
  47. ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
  48. #-----------------------------------------------------------------------------
  49. # Create the kwsys library for CMake.
  50. SET(KWSYS_NAMESPACE cmsys)
  51. SET(KWSYS_USE_SystemTools 1)
  52. SET(KWSYS_USE_Directory 1)
  53. SET(KWSYS_USE_RegularExpression 1)
  54. SET(KWSYS_USE_Base64 1)
  55. SET(KWSYS_USE_Process 1)
  56. SET(KWSYS_USE_CommandLineArguments 1)
  57. SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
  58. SUBDIRS(Source/kwsys)
  59. #-----------------------------------------------------------------------------
  60. # Build zlib library for Curl, CMake, and CTest.
  61. SUBDIRS(Utilities/cmzlib)
  62. SET(CMAKE_ZLIB_INCLUDES
  63. "${CMAKE_CURRENT_BINARY_DIR}/Utilities"
  64. )
  65. SET(CMAKE_ZLIB_LIBRARIES "cmzlib")
  66. SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
  67. SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
  68. SET(CURL_SPECIAL_ZLIB_H "cmzlib/zlib.h")
  69. #-----------------------------------------------------------------------------
  70. # Build Curl library for CTest.
  71. SUBDIRS(Utilities/cmcurl)
  72. SET(CMAKE_CURL_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/Utilities")
  73. SET(CMAKE_CURL_LIBRARIES "cmcurl")
  74. #-----------------------------------------------------------------------------
  75. # Build Curl library for CTest.
  76. SUBDIRS(Utilities/cmtar)
  77. SET(CMAKE_TAR_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar")
  78. SET(CMAKE_TAR_LIBRARIES "cmtar")
  79. #-----------------------------------------------------------------------------
  80. # Build expat library for CMake and CTest.
  81. SUBDIRS(Utilities/cmexpat)
  82. SET(CMAKE_EXPAT_INCLUDES
  83. "${CMAKE_CURRENT_BINARY_DIR}/Utilities"
  84. "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmexpat"
  85. )
  86. SET(CMAKE_EXPAT_LIBRARIES "cmexpat")
  87. SUBDIRS(Utilities/cmxmlrpc)
  88. SET(CMAKE_XMLRPC_INCLUDES
  89. "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmxmlrpc"
  90. "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmxmlrpc"
  91. )
  92. SET(CMAKE_XMLRPC_LIBRARIES "cmXMLRPC")
  93. IF (UNIX)
  94. INCLUDE (${CMake_SOURCE_DIR}/Modules/FindCurses.cmake OPTIONAL)
  95. IF (CURSES_LIBRARY)
  96. SUBDIRS(Source/CursesDialog/form)
  97. ELSE (CURSES_LIBRARY)
  98. MESSAGE("Curses libraries were not found. Curses GUI for CMake will not be build.")
  99. ENDIF (CURSES_LIBRARY)
  100. ENDIF (UNIX)
  101. SUBDIRS(Source Modules Templates Utilities)
  102. ENABLE_TESTING()
  103. # Include the standard Dart testing module
  104. #SET(DART_ROOT "" CACHE INTERNAL "" FORCE)
  105. INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
  106. # use the ansi CXX compile flag for building cmake
  107. IF (CMAKE_ANSI_CXXFLAGS)
  108. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
  109. ENDIF (CMAKE_ANSI_CXXFLAGS)
  110. IF (CMAKE_ANSI_CFLAGS)
  111. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
  112. ENDIF (CMAKE_ANSI_CFLAGS)
  113. # add some testing dependencies
  114. IF(BUILD_TESTING)
  115. IF (DART_ROOT)
  116. CONFIGURE_FILE(${CMake_SOURCE_DIR}/CMakeLogo.gif ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
  117. ENDIF (DART_ROOT)
  118. ENDIF(BUILD_TESTING)
  119. MARK_AS_ADVANCED(DART_ROOT)
  120. MARK_AS_ADVANCED(CURL_TESTING)
  121. SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/bin CACHE INTERNAL
  122. "Where to put the executables for CMake"
  123. )
  124. SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
  125. "Where to put the libraries for CMake"
  126. )
  127. INCLUDE_REGULAR_EXPRESSION("^.*$")
  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.ctest.in
  133. ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
  134. SET(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
  135. IF(WIN32)
  136. IF(NOT UNIX)
  137. IF(NOT BORLAND)
  138. IF(NOT MINGW )
  139. SET(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
  140. ENDIF(NOT MINGW )
  141. ENDIF(NOT BORLAND)
  142. ENDIF(NOT UNIX)
  143. ENDIF(WIN32)
  144. CONFIGURE_FILE(
  145. "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  146. "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  147. IMMEDIATE @ONLY)
  148. ADD_CUSTOM_TARGET(uninstall
  149. "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
  150. # include support for making the release
  151. INCLUDE (${CMake_SOURCE_DIR}/Utilities/Release/Release.cmake)
  152. # If the cmake version includes cpack, use it
  153. IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
  154. SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
  155. SET(CPACK_PACKAGE_VENDOR "Kitware")
  156. SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
  157. SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}")
  158. SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}")
  159. SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}")
  160. SET(CPACK_PACKAGE_EXECUTABLE "CMakeSetup")
  161. SET(CPACK_PACKAGE_EXECUTABLE_LABEL "CMake")
  162. IF(WIN32 AND NOT UNIX)
  163. # There is a bug in NSI that does not handle full unix paths properly. Make
  164. # sure there is at least one set of four (4) backlasshes.
  165. SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp")
  166. ENDIF(WIN32 AND NOT UNIX)
  167. INCLUDE(CPack)
  168. ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")