2 CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
3 MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
5 # The CMake version number.
6 SET(CMake_VERSION_MAJOR 2)
7 SET(CMake_VERSION_MINOR 3)
8 SET(CMake_VERSION_PATCH 5)
9 SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
10 SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
12 SET(BUILD_SHARED_LIBS OFF)
14 # The CMake executables do not need any rpath to run in the build or
16 SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
18 SET(CMAKE_DATA_DIR "/share/CMake" CACHE STRING
19 "Install location for data (relative to prefix).")
20 SET(CMAKE_DOC_DIR "/doc/CMake" CACHE STRING
21 "Install location for documentation (relative to prefix).")
22 SET(CMAKE_MAN_DIR "/man" CACHE STRING
23 "Install location for man pages (relative to prefix).")
24 MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
26 IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
27 IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
28 SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
29 ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
30 IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
31 SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
32 ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
33 INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
34 ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
36 # Disable deprecation warnings for standard C functions.
37 IF(CMAKE_COMPILER_2005)
38 ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
39 ENDIF(CMAKE_COMPILER_2005)
41 #silence duplicate symbol warnings on AIX
42 IF(CMAKE_SYSTEM MATCHES "AIX.*")
43 IF(NOT CMAKE_COMPILER_IS_GNUCXX)
44 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
45 ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
46 ENDIF(CMAKE_SYSTEM MATCHES "AIX.*")
48 IF(CMAKE_SYSTEM MATCHES "IRIX.*")
49 IF(NOT CMAKE_COMPILER_IS_GNUCXX)
50 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
51 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
52 ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
53 ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
55 IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
56 IF(NOT CMAKE_COMPILER_IS_GNUCXX)
57 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
58 ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
59 ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
61 #-----------------------------------------------------------------------------
62 # Create the kwsys library for CMake.
63 SET(KWSYS_NAMESPACE cmsys)
64 SET(KWSYS_USE_SystemTools 1)
65 SET(KWSYS_USE_Directory 1)
66 SET(KWSYS_USE_RegularExpression 1)
67 SET(KWSYS_USE_Base64 1)
68 SET(KWSYS_USE_Process 1)
69 SET(KWSYS_USE_CommandLineArguments 1)
70 SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
73 #-----------------------------------------------------------------------------
74 # Build zlib library for Curl, CMake, and CTest.
75 SUBDIRS(Utilities/cmzlib)
76 SET(CMAKE_ZLIB_INCLUDES
77 "${CMAKE_CURRENT_BINARY_DIR}/Utilities"
79 SET(CMAKE_ZLIB_LIBRARIES "cmzlib")
80 SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
81 SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
82 SET(CURL_SPECIAL_ZLIB_H "cmzlib/zlib.h")
84 #-----------------------------------------------------------------------------
85 # Build Curl library for CTest.
86 SUBDIRS(Utilities/cmcurl)
87 SET(CMAKE_CURL_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/Utilities")
88 SET(CMAKE_CURL_LIBRARIES "cmcurl")
90 #-----------------------------------------------------------------------------
91 # Build Curl library for CTest.
92 SUBDIRS(Utilities/cmtar)
93 SET(CMAKE_TAR_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar")
94 SET(CMAKE_TAR_LIBRARIES "cmtar")
96 #-----------------------------------------------------------------------------
97 # Build expat library for CMake and CTest.
98 SUBDIRS(Utilities/cmexpat)
99 SET(CMAKE_EXPAT_INCLUDES
100 "${CMAKE_CURRENT_BINARY_DIR}/Utilities"
101 "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmexpat"
103 SET(CMAKE_EXPAT_LIBRARIES "cmexpat")
105 SUBDIRS(Utilities/cmxmlrpc)
106 SET(CMAKE_XMLRPC_INCLUDES
107 "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmxmlrpc"
108 "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmxmlrpc"
110 SET(CMAKE_XMLRPC_LIBRARIES "cmXMLRPC")
113 FIND_PACKAGE(Curses QUIET)
115 OPTION(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
116 ELSE (CURSES_LIBRARY)
117 MESSAGE("Curses libraries were not found. Curses GUI for CMake will not be build.")
118 SET(BUILD_CursesDialog 0)
119 ENDIF (CURSES_LIBRARY)
121 SET(BUILD_CursesDialog 0)
124 IF(BUILD_CursesDialog)
125 SUBDIRS(Source/CursesDialog/form)
126 ENDIF(BUILD_CursesDialog)
128 INCLUDE(CheckSymbolExists)
129 CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
130 CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
132 SUBDIRS(Source Modules Templates Utilities Tests/CMakeTests)
135 # Include the standard Dart testing module
136 #SET(DART_ROOT "" CACHE INTERNAL "" FORCE)
137 INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
139 # use the ansi CXX compile flag for building cmake
141 IF (CMAKE_ANSI_CXXFLAGS)
142 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
143 ENDIF (CMAKE_ANSI_CXXFLAGS)
145 IF (CMAKE_ANSI_CFLAGS)
146 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
147 ENDIF (CMAKE_ANSI_CFLAGS)
149 # add some testing dependencies
152 CONFIGURE_FILE(${CMake_SOURCE_DIR}/CMakeLogo.gif ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
155 MARK_AS_ADVANCED(DART_ROOT)
156 MARK_AS_ADVANCED(CURL_TESTING)
158 SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/bin CACHE INTERNAL
159 "Where to put the executables for CMake"
161 SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
162 "Where to put the libraries for CMake"
165 INCLUDE_REGULAR_EXPRESSION("^.*$")
167 CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
168 ${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
169 CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
170 ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
172 CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.ctest.in
173 ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
175 SET(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
180 SET(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
185 IF(CMAKE_BUILD_ON_VISUAL_STUDIO)
186 IF("CMake_HAVE_MFC" MATCHES "^CMake_HAVE_MFC$")
187 SET(CHECK_INCLUDE_FILE_VAR "afxwin.h")
188 CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
189 ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
190 MESSAGE(STATUS "Looking for MFC")
191 TRY_COMPILE(CMake_HAVE_MFC
193 ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFile.cxx
195 -DCMAKE_MFC_FLAG:STRING=2
196 -DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
197 OUTPUT_VARIABLE OUTPUT)
199 MESSAGE(STATUS "Looking for MFC - found")
200 SET(CMake_HAVE_MFC 1 CACHE INTERNAL "Have MFC?")
201 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
202 "Determining if MFC exists passed with the following output:\n"
205 MESSAGE(STATUS "Looking for MFC - not found")
206 SET(CMake_HAVE_MFC 0 CACHE INTERNAL "Have MFC?")
207 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
208 "Determining if MFC exists failed with the following output:\n"
210 ENDIF(CMake_HAVE_MFC)
211 ENDIF("CMake_HAVE_MFC" MATCHES "^CMake_HAVE_MFC$")
214 OPTION(BUILD_MFCDialog "Whether to build the CMakeSetup MFC dialog." ON)
216 SET(BUILD_MFCDialog 0)
217 ENDIF(CMake_HAVE_MFC)
218 ELSE(CMAKE_BUILD_ON_VISUAL_STUDIO)
219 SET(BUILD_MFCDialog 0)
220 ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO)
223 "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
224 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
227 ADD_CUSTOM_TARGET(uninstall
228 "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
230 # include support for making the release
231 INCLUDE (${CMake_SOURCE_DIR}/Utilities/Release/Release.cmake)
233 # If the cmake version includes cpack, use it
234 IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
235 IF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
236 SET(CMAKE_INSTALL_MFC_LIBRARIES 1)
237 INCLUDE(InstallRequiredSystemLibraries)
238 ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
239 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
240 SET(CPACK_PACKAGE_VENDOR "Kitware")
241 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
242 SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}")
243 SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}")
244 SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}")
246 IF(WIN32 AND NOT UNIX)
247 # There is a bug in NSI that does not handle full unix paths properly. Make
248 # sure there is at least one set of four (4) backlasshes.
249 SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp")
250 SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake")
251 ELSE(WIN32 AND NOT UNIX)
252 SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
253 ENDIF(WIN32 AND NOT UNIX)
255 ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")