File: CMakeLists.txt

package info (click to toggle)
cmake 2.8.11.1-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 37,056 kB
  • sloc: cpp: 157,219; ansic: 137,155; yacc: 3,254; sh: 2,745; xml: 2,483; lex: 1,028; lisp: 215; python: 199; objc: 134; f90: 105; perl: 99; fortran: 93; makefile: 65; tcl: 55; asm: 28; php: 25; ruby: 22; java: 20
file content (70 lines) | stat: -rw-r--r-- 2,457 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 2.8)

project(Qt4Deploy)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install)

find_package(Qt4 REQUIRED QtMain QtCore QtSql)
include(${QT_USE_FILE})

add_executable(testdeploy MACOSX_BUNDLE testdeploy.cpp)
target_link_libraries(testdeploy ${QT_LIBRARIES})
set_target_properties(testdeploy PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}")

if(CMAKE_CONFIGURATION_TYPES AND QT_QTCORE_LIBRARY_RELEASE AND QT_QTCORE_LIBRARY_DEBUG)
  # note: installing debug Qt libraries from a Qt installation configured with
  # -debug-and-release not yet supported (very low priority).
  install(CODE "
  if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\")
    return()
  endif()
  ")
endif()

# install the Qt4 app with qsqlite plugin
install(CODE "file(REMOVE_RECURSE \"${CMAKE_INSTALL_PREFIX}\")")
install(TARGETS testdeploy DESTINATION .)
include(../../Modules/DeployQt4.cmake)
if(APPLE)
  install_qt4_executable(testdeploy.app "qsqlite")
elseif(WIN32)
  install_qt4_executable(testdeploy.exe "qsqlite")
else()
  install_qt4_executable(testdeploy "qsqlite")
endif()


# test depends on standard qsqlite plugin
if(QT_QSQLITE_PLUGIN_DEBUG OR QT_QSQLITE_PLUGIN_RELEASE)

  # test the deployed Qt application
  if(APPLE)
    install(CODE "
      message(STATUS \"executing: ${CMAKE_INSTALL_PREFIX}/testdeploy.app/Contents/MacOS/testdeploy\")
      execute_process(COMMAND \"${CMAKE_INSTALL_PREFIX}/testdeploy.app/Contents/MacOS/testdeploy\"
                      RESULT_VARIABLE result)
      if(NOT result STREQUAL \"0\")
        message(FATAL_ERROR \"error running testdeploy app\")
      endif()
    ")
  else()
    install(CODE "
      message(STATUS \"executing: ${CMAKE_INSTALL_PREFIX}/testdeploy\")
      execute_process(COMMAND \"${CMAKE_INSTALL_PREFIX}/testdeploy\"
                      RESULT_VARIABLE result)
      if(NOT result STREQUAL \"0\")
        message(FATAL_ERROR \"error running testdeploy app\")
      endif()
    ")
  endif()

  # custom target to install and test the installation at build time
  if(CMAKE_CONFIGURATION_TYPES)
    set(install_config "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
  endif()

  add_custom_target(testdeploy_test ALL
    COMMAND ${CMAKE_COMMAND} ${install_config} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake
    COMMENT "${CMAKE_COMMAND} ${install_config} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake"
    DEPENDS testdeploy)

endif()