~ubuntu-branches/debian/sid/simpleitk/sid

« back to all changes in this revision

Viewing changes to CMake/sitkStripOption.cmake

  • Committer: Package Import Robot
  • Author(s): Ghislain Antony Vaillant
  • Date: 2017-11-02 08:49:18 UTC
  • Revision ID: package-import@ubuntu.com-20171102084918-7hs09ih668xq87ej
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#------------------------------------------------------------------------------
 
3
# Strip Option
 
4
 
 
5
# Add option to strip wrapping libraries.
 
6
# Since the wrapping libraries don't get installed by the normal cmake
 
7
# installation process, this option enables stripping of the libraries
 
8
# as part of the build process. It should be used on the laguage
 
9
# targets and the the SimpleITK iterface, as those can be installed
 
10
# into the system.
 
11
option(SimpleITK_BUILD_STRIP "Strip executables and libraries after building." OFF)
 
12
mark_as_advanced(SimpleITK_BUILD_STRIP)
 
13
set(CMAKE_STRIP_FLAGS "-x" CACHE STRING "Flags used by strip in the post_build.")
 
14
mark_as_advanced(CMAKE_STRIP_FLAGS)
 
15
separate_arguments(CMAKE_STRIP_FLAGS)
 
16
 
 
17
function(sitk_strip_target tgt)
 
18
  if(NOT SimpleITK_BUILD_STRIP OR "${CMAKE_STRIP}" STREQUAL "" )
 
19
    return()
 
20
  endif()
 
21
  get_property(type TARGET ${tgt} PROPERTY TYPE)
 
22
  if(NOT type STREQUAL STATIC_LIBRARY)
 
23
    add_custom_command(
 
24
      TARGET ${tgt}
 
25
      POST_BUILD
 
26
      COMMAND ${CMAKE_STRIP} ${CMAKE_STRIP_FLAGS} "$<TARGET_FILE:${tgt}>"
 
27
      )
 
28
  endif()
 
29
 
 
30
endfunction()