CMakeLists.txt 10.2 KB
Newer Older
Ken Martin's avatar
Ken Martin committed
1 2
CMAKE_MINIMUM_REQUIRED(VERSION 1.3)

3
SET(SRCS
4
cmake.cxx
5
cmakewizard.cxx
6 7 8 9 10 11
cmMakeDepend.cxx
cmMakefile.cxx
cmRegularExpression.cxx
cmSourceFile.cxx
cmSystemTools.cxx
cmDirectory.cxx
12
cmDocumentation.cxx
Ken Martin's avatar
Ken Martin committed
13
cmDynamicLoader.cxx
14 15 16 17 18
cmCommands.cxx
cmTarget.cxx
cmCustomCommand.cxx
cmCacheManager.cxx
cmSourceGroup.cxx
19
cmListFileCache.cxx
Ken Martin's avatar
Ken Martin committed
20 21 22 23
cmGlobalGenerator.cxx
cmGlobalUnixMakefileGenerator.cxx
cmLocalGenerator.cxx
cmLocalUnixMakefileGenerator.cxx
24
cmVariableWatch.cxx
25 26 27 28 29 30 31
cmake.h
cmakewizard.h
cmMakeDepend.h
cmMakefile.h
cmRegularExpression.h
cmSourceFile.h
cmSystemTools.h
Ken Martin's avatar
Ken Martin committed
32
cmDynamicLoader.h
33 34 35 36 37 38 39
cmDirectory.h
cmCommands.h
cmTarget.h
cmCustomCommand.h
cmCacheManager.h
cmSourceGroup.h
cmListFileCache.h
Ken Martin's avatar
Ken Martin committed
40 41 42 43
cmGlobalGenerator.h
cmGlobalUnixMakefileGenerator.h
cmLocalGenerator.h
cmLocalUnixMakefileGenerator.h
44
cmVariableWatch.h
Ken Martin's avatar
Ken Martin committed
45 46
)

47 48 49
# configure the .h file
CONFIGURE_FILE(
${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in 
50
${CMake_BINARY_DIR}/Source/cmConfigure.h )
51

52 53
# add the include path to find the .h 
INCLUDE_DIRECTORIES(${CMake_BINARY_DIR}/Source)
54
INCLUDE_DIRECTORIES(${CMake_SOURCE_DIR}/Source)
55

56 57 58
# let cmake know it is supposed to use it
ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)

59 60 61 62 63 64 65 66 67
IF (APPLE)
  SET(SRCS ${SRCS}
    cmGlobalCodeWarriorGenerator.cxx
    cmLocalCodeWarriorGenerator.cxx
    cmGlobalCodeWarriorGenerator.h
    cmLocalCodeWarriorGenerator.h
    )
ENDIF (APPLE)

Ken Martin's avatar
Ken Martin committed
68
IF (WIN32)
69 70
  IF(NOT UNIX)
    SET(SRCS ${SRCS}
Ken Martin's avatar
Ken Martin committed
71 72 73 74 75 76 77 78 79 80 81 82
                    cmGlobalBorlandMakefileGenerator.cxx
                    cmGlobalNMakeMakefileGenerator.cxx
                    cmGlobalVisualStudio6Generator.cxx
                    cmLocalVisualStudio6Generator.cxx
                    cmGlobalVisualStudio7Generator.cxx
                    cmLocalVisualStudio7Generator.cxx
                    cmGlobalBorlandMakefileGenerator.h
                    cmGlobalNMakeMakefileGenerator.h
                    cmGlobalVisualStudio6Generator.h
                    cmLocalVisualStudio6Generator.h
                    cmGlobalVisualStudio7Generator.h
                    cmLocalVisualStudio7Generator.h
83 84
		    cmWin32ProcessExecution.cxx
		    cmWin32ProcessExecution.h
85
                    )
86
    IF(  NOT BORLAND )
87
      LINK_LIBRARIES( rpcrt4.lib )
88 89
      ADD_EXECUTABLE(cmw9xcom cmw9xcom.cxx)
      TARGET_LINK_LIBRARIES(cmw9xcom CMakeLib)
90
      SUBDIRS(MFCDialog)
91
    ENDIF( NOT BORLAND )
92
  ENDIF(NOT UNIX)
Ken Martin's avatar
Ken Martin committed
93 94
ENDIF (WIN32)

95
# create a library used by the command line and the GUI
96 97
ADD_LIBRARY(CMakeLib ${SRCS})

Ken Martin's avatar
Ken Martin committed
98

99 100
# always link in the library
# the library is found here
Berk Geveci's avatar
Berk Geveci committed
101
LINK_DIRECTORIES(${CMake_BINARY_DIR}/Source)
102

103
ADD_EXECUTABLE(cmake cmakemain.cxx)
104
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
105
ADD_EXECUTABLE(ctest ctest.cxx cmCTest.cxx)
Ken Martin's avatar
Ken Martin committed
106

107 108 109 110
IF (UNIX)
  TARGET_LINK_LIBRARIES(CMakeLib ${CMAKE_DL_LIBS})
ENDIF (UNIX)

Ken Martin's avatar
Ken Martin committed
111 112 113
TARGET_LINK_LIBRARIES(cmake CMakeLib)
TARGET_LINK_LIBRARIES(DumpDocumentation CMakeLib)
TARGET_LINK_LIBRARIES(ctest CMakeLib)
Bill Hoffman's avatar
Bill Hoffman committed
114 115 116 117 118 119 120 121 122

IF (UNIX)
  INCLUDE (${CMake_SOURCE_DIR}/Modules/FindCurses.cmake OPTIONAL)
  IF (CURSES_LIBRARY)
    SUBDIRS(CursesDialog/form)
    INCLUDE(${CMake_SOURCE_DIR}/Source/CursesDialog/CMakeLists.txt)
  ENDIF (CURSES_LIBRARY)
ENDIF (UNIX)

123 124 125 126 127 128
OPTION(CMAKE_BUILD_WX_DIALOG "Build wxWindows dialog for CMake" FALSE)
MARK_AS_ADVANCED(CMAKE_BUILD_WX_DIALOG)
IF(CMAKE_BUILD_WX_DIALOG)
  SUBDIRS(WXDialog)
ENDIF(CMAKE_BUILD_WX_DIALOG)

129 130 131 132
IF (NOT DART_ROOT)
SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
ENDIF (NOT DART_ROOT)

133 134 135 136
CONFIGURE_FILE(
  ${CMake_SOURCE_DIR}/Source/cmaketest.h.in 
  ${CMake_BINARY_DIR}/Source/cmaketest.h ESCAPE_QUOTES)

Ken Martin's avatar
Ken Martin committed
137 138
ADD_EXECUTABLE(cmaketest cmaketest.cxx)
TARGET_LINK_LIBRARIES(cmaketest CMakeLib)
139

140
IF(BUILD_TESTING)
141
    ADD_TEST(DumpDocumentation ${CMake_BINARY_DIR}/Source/DumpDocumentation
142
      --all-for-coverage)
Sebastien Barre's avatar
Sebastien Barre committed
143

144 145 146 147 148
    ADD_TEST(SystemInformation ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/SystemInformation
      ${CMake_BINARY_DIR}/Tests/SystemInformation 
      DumpInformation)

149 150 151 152 153
    ADD_TEST(TryCompile ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/TryCompile
      ${CMake_BINARY_DIR}/Tests/TryCompile 
      TryCompile)

154 155
    ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/Simple 
Sebastien Barre's avatar
Sebastien Barre committed
156 157 158
      ${CMake_BINARY_DIR}/Tests/Simple 
      simple)

159 160 161 162 163
    ADD_TEST(conly ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/COnly 
      ${CMake_BINARY_DIR}/Tests/COnly 
      conly)

Andy Cedilnik's avatar
Andy Cedilnik committed
164 165 166
    ADD_TEST(X11 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/X11
      ${CMake_BINARY_DIR}/Tests/X11 
167
      UseX11)
Andy Cedilnik's avatar
Andy Cedilnik committed
168

Ken Martin's avatar
Ken Martin committed
169 170 171 172 173
    ADD_TEST(LoadedCommand ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/LoadCommand 
      ${CMake_BINARY_DIR}/Tests/LoadCommand 
      LoadedCommand)

174 175 176 177 178
    ADD_TEST(LoadedCommandOneConfig ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/LoadCommand 
      ${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig
      LoadedCommand ONLY_ONE_CONFIG)

179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
    # Como does not seem to support shared libraries.
    GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
    IF(CMAKE_BASE_NAME MATCHES "^como$")
      SET(COMPILER_IS_COMO 1)
    ENDIF(CMAKE_BASE_NAME MATCHES "^como$")
    IF(NOT COMPILER_IS_COMO)
      ADD_TEST(complex ${CMake_BINARY_DIR}/Source/cmaketest 
        ${CMake_SOURCE_DIR}/Tests/Complex 
        ${CMake_BINARY_DIR}/Tests/Complex 
        complex 
        ${CMake_BINARY_DIR}/Tests/Complex/bin)

      ADD_TEST(complexOneConfig ${CMake_BINARY_DIR}/Source/cmaketest 
        ${CMake_SOURCE_DIR}/Tests/Complex 
        ${CMake_BINARY_DIR}/Tests/ComplexOneConfig 
        complex 
        ${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin ONLY_ONE_CONFIG)
    ENDIF(NOT COMPILER_IS_COMO)
197

Bill Hoffman's avatar
Bill Hoffman committed
198 199 200 201 202
    ADD_TEST(Example ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Example
      ${CMake_BINARY_DIR}/Example
      helloDemo
      ${CMake_BINARY_DIR}/Example/Demo
Sebastien Barre's avatar
Sebastien Barre committed
203 204 205 206 207 208 209 210 211 212 213 214 215 216
      HELLO)

    ADD_TEST(testing ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/Testing 
      ${CMake_BINARY_DIR}/Tests/Testing
      testing
      ${CMake_BINARY_DIR}/Tests/Testing/bin)

    ADD_TEST(wrapping ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/Wrapping 
      ${CMake_BINARY_DIR}/Tests/Wrapping
      wrapping
      ${CMake_BINARY_DIR}/Tests/Wrapping/bin)

217
    INCLUDE ( ${CMAKE_ROOT}/Modules/FindQt.cmake )
Bill Hoffman's avatar
Bill Hoffman committed
218 219 220 221 222 223
    MARK_AS_ADVANCED(
     QT_INCLUDE_PATH
     QT_MOC_EXE
     QT_QT_LIBRARY
     QT_UIC_EXE)

224 225 226 227 228 229 230
    IF (QT_FOUND)
      ADD_TEST(qtwrapping ${CMake_BINARY_DIR}/Source/cmaketest 
        ${CMake_SOURCE_DIR}/Tests/Wrapping 
        ${CMake_BINARY_DIR}/Tests/Wrapping
        qtwrapping
        ${CMake_BINARY_DIR}/Tests/Wrapping/bin)
    ENDIF (QT_FOUND)
231

232 233 234 235 236 237
    ADD_TEST(testdriver1 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/TestDriver 
      ${CMake_BINARY_DIR}/Tests/TestDriver
      TestDriverTest
      ${CMake_BINARY_DIR}/Tests/Wrapping/bin
      TestDriverTest test1)
238

239 240 241 242 243 244
    ADD_TEST(testdriver2 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/TestDriver 
      ${CMake_BINARY_DIR}/Tests/TestDriver
      TestDriverTest
      ${CMake_BINARY_DIR}/Tests/Wrapping/bin
      TestDriverTest test2)
245

246 247 248 249 250
    ADD_TEST(testdriver3 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/TestDriver 
      ${CMake_BINARY_DIR}/Tests/TestDriver
      TestDriverTest
      ${CMake_BINARY_DIR}/Tests/Wrapping/bin
251
      TestDriverTest subdir/test3)
252

253
    ADD_TEST(dependency_w_libout ${CMake_BINARY_DIR}/Source/cmaketest 
254
      ${CMake_SOURCE_DIR}/Tests/Dependency 
255
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut
256
      exec
257 258 259 260 261 262 263 264
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec
      Dependency CMAKE_ARGS -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib)

    ADD_TEST(dependency_wo_lib_out ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/Dependency 
      ${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut
      exec
      ${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut/Exec
265 266
      Dependency)

267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
    ADD_TEST(dependency2 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/Dependency 
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut
      exec2
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec2
      Dependency CMAKE_ARGS -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib)

    ADD_TEST(dependency3 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/Dependency 
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut
      exec3
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec3
      Dependency CMAKE_ARGS -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib)

    ADD_TEST(dependency4 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/Dependency 
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut
      exec4
      ${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec4
      Dependency CMAKE_ARGS -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib)

    ADD_TEST(linkline ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/LinkLine
      ${CMake_BINARY_DIR}/Tests/LinkLine
      Exec
      ${CMake_BINARY_DIR}/Tests/LinkLine
      LinkLine)
294 295 296 297 298 299 300 301 302 303 304 305 306 307

    ADD_TEST(linkorder1 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/LinkLineOrder
      ${CMake_BINARY_DIR}/Tests/LinkLineOrder
      Exec1
      ${CMake_BINARY_DIR}/Tests/LinkLineOrder
      LinkLineOrder)

    ADD_TEST(linkorder2 ${CMake_BINARY_DIR}/Source/cmaketest 
      ${CMake_SOURCE_DIR}/Tests/LinkLineOrder
      ${CMake_BINARY_DIR}/Tests/LinkLineOrder
      Exec2
      ${CMake_BINARY_DIR}/Tests/LinkLineOrder
      LinkLineOrder)
Yves Starreveld's avatar
Yves Starreveld committed
308

Andy Cedilnik's avatar
Andy Cedilnik committed
309 310 311
    ADD_TEST(curl ${CMake_BINARY_DIR}/Source/cmaketest 
             ${CMake_SOURCE_DIR}/Source/CTest/Curl
             ${CMake_BINARY_DIR}/Tests/Curl
312
             LIBCURL)
Andy Cedilnik's avatar
Andy Cedilnik committed
313

Yves Starreveld's avatar
Yves Starreveld committed
314 315 316 317 318 319
    IF (APPLE)
      ADD_TEST(objc++ ${CMake_BINARY_DIR}/Source/cmaketest
		        ${CMake_SOURCE_DIR}/Tests/Objc++
			${CMake_BINARY_DIR}/Tests/Objc++
			objc++)
    ENDIF (APPLE)
320 321
ENDIF(BUILD_TESTING)

Bill Hoffman's avatar
Bill Hoffman committed
322 323
INCLUDE (${CMAKE_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
INCLUDE (${CMAKE_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
324

Ken Martin's avatar
Ken Martin committed
325
INSTALL_TARGETS(/bin cmake)
326
INSTALL_TARGETS(/bin ctest)
327
INSTALL_TARGETS(/bin cmaketest)
328
INSTALL_FILES(/share/CMake/include cmCPluginAPI.h)