File: vtkSelectSharedLibraries.cmake

package info (click to toggle)
vtk 5.0.4-1.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 51,084 kB
  • ctags: 70,426
  • sloc: cpp: 524,166; ansic: 220,276; tcl: 43,377; python: 14,037; perl: 3,102; java: 1,436; yacc: 1,033; sh: 339; lex: 248; makefile: 197; asm: 154
file content (67 lines) | stat: -rw-r--r-- 3,543 bytes parent folder | download | duplicates (2)
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
IF(NOT VTK_SHARED_LIBRARIES_SELECTED)
  SET(VTK_SHARED_LIBRARIES_SELECTED 1)

  # We need the VTK_DEPENDENT_OPTION macro.
  INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkDependentOption.cmake)

  # Choose static or shared libraries.
  OPTION(BUILD_SHARED_LIBS "Build VTK with shared libraries." OFF)
  SET(VTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})

  # On platforms that support rpath users may want to use them to make
  # running VTK from the build tree easy.  It is not safe to install
  # programs built with an rpath pointing at the build tree, so we must
  # disable install support when using the rpath feature.
  IF(NOT WIN32)
    # Choose whether to use the rpath feature.  Parent projects may
    # set VTK_FORCE_RPATH to force the value on or off without providing
    # the option.
    IF(VTK_FORCE_RPATH)
      SET(VTK_USE_RPATH ${VTK_FORCE_RPATH})
    ELSE(VTK_FORCE_RPATH)
      IF("VTK_USE_RPATH_DEFAULT" MATCHES "^VTK_USE_RPATH_DEFAULT$")
        # Choosing a default value for this option is tricky.  Dashboard
        # scripts need to have this ON or set the LD_LIBRARY_PATH, which at
        # the time of this writing none does.  Therefore the default must be
        # ON.  However, users that download a VTK release to build and install
        # it will not know to turn this OFF and will be confused when they get
        # an empty installation.  One solution to this dilema is to note that
        # users that do not know what they are doing will generally use a
        # release.  Dashboards use the latest development version.  Users that
        # checkout from the CVS head will usually run from the build tree or
        # at least understand this option.  Therefore a simple decision
        # criterion is whether VTK_MINOR_VERSION is odd or even.
        IF(VTK_MINOR_VERSION MATCHES "[02468]$")
          # This is a release version.  Default to not use rpath.
          SET(VTK_USE_RPATH_DEFAULT OFF)
        ELSE(VTK_MINOR_VERSION MATCHES "[02468]$")
          # This is a development version.  Default to use rpath.
          SET(VTK_USE_RPATH_DEFAULT ON)
        ENDIF(VTK_MINOR_VERSION MATCHES "[02468]$")
      ENDIF("VTK_USE_RPATH_DEFAULT" MATCHES "^VTK_USE_RPATH_DEFAULT$")
      VTK_DEPENDENT_OPTION(VTK_USE_RPATH "Build shared libraries with rpath.  This makes it easy to run executables from the build tree when using shared libraries, but removes install support."
                           ${VTK_USE_RPATH_DEFAULT}
                           "BUILD_SHARED_LIBS" OFF)
    ENDIF(VTK_FORCE_RPATH)

    # Configure VTK according to the rpath setting.
    IF(VTK_USE_RPATH)
      # We will use rpath support.  Tell CMake not to skip it.
      SET(CMAKE_SKIP_RPATH 0 CACHE INTERNAL "Whether to build with rpath." FORCE)

      # If someone is trying to install do not do an entire build with
      # the wrong rpath feature setting just to report failed
      # installation.
      SET(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)

      # Add a dummy target and attach an install rule that will always fail
      # and produce a message explaining why installation is disabled.
      ADD_CUSTOM_TARGET(vtk_install_disabled)
      SET_TARGET_PROPERTIES(vtk_install_disabled PROPERTIES
        PRE_INSTALL_SCRIPT ${VTK_SOURCE_DIR}/CMake/InstallDisabled.cmake)
    ELSE(VTK_USE_RPATH)
      # We will not use rpath support.  Tell CMake to skip it.
      SET(CMAKE_SKIP_RPATH 1 CACHE INTERNAL "Whether to build with rpath." FORCE)
    ENDIF(VTK_USE_RPATH)
  ENDIF(NOT WIN32)
ENDIF(NOT VTK_SHARED_LIBRARIES_SELECTED)