fixed: auto_ptr -> unique_ptr
[opensg.git] / Support / zlib / CMakeLists.txt
blob8c627eec09bb292b503982e0701488cdda5ff5f8
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3 IF(OSGZLibSrcDir)
5   MESSAGE(STATUS "adding zlib from : ${OSGZLibSrcDir}")
7   PROJECT(OSGZLib)
9   SET(${PROJECT_NAME}SharedTarget osgzlib)
10   SET(${PROJECT_NAME}StaticTarget libosgzlib)
12   IF(EXISTS ${OSGZLibSrcDir}/source)
13     SET(OSGZLibSrcDir ${OSGZLibSrcDir}/source CACHE PATH "")
14   ENDIF()
16   SET(OSG_ZLIB_SRCS ${OSGZLibSrcDir}/adler32.c 
17                     ${OSGZLibSrcDir}/compress.c 
18                     ${OSGZLibSrcDir}/crc32.c 
19                     ${OSGZLibSrcDir}/deflate.c 
20                     ${OSGZLibSrcDir}/infback.c 
21                     ${OSGZLibSrcDir}/inffast.c 
22                     ${OSGZLibSrcDir}/inflate.c 
23                     ${OSGZLibSrcDir}/inftrees.c 
24                     ${OSGZLibSrcDir}/trees.c 
25                     ${OSGZLibSrcDir}/uncompr.c 
26                     ${OSGZLibSrcDir}/zutil.c)
27   IF(EXISTS ${OSGZLibSrcDir}/gzio.c)
28     SET(OSG_ZLIB_SRCS ${OSG_ZLIB_SRCS}
29                       ${OSGZLibSrcDir}/gzio.c)
30   ELSE()
31     SET(OSG_ZLIB_SRCS ${OSG_ZLIB_SRCS}
32                       ${OSGZLibSrcDir}/gzclose.c
33                       ${OSGZLibSrcDir}/gzlib.c
34                       ${OSGZLibSrcDir}/gzread.c
35                       ${OSGZLibSrcDir}/gzwrite.c)
36   ENDIF()
38   SET(OSG_ZLIB_HDR ${OSGZLibSrcDir}/zlib.h 
39                    ${OSGZLibSrcDir}/zconf.h)
41   INCLUDE_DIRECTORIES(${OSGZLibSrcDir})
43   IF(BUILD_SHARED_LIBS)
44     ADD_LIBRARY(${${PROJECT_NAME}SharedTarget} SHARED ${OSG_ZLIB_SRCS})
46     ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}SharedTarget})
48     SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
49                           DEFINE_SYMBOL ZLIB_DLL   
50                           DEBUG_POSTFIX "D")
52     INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
53                 CONFIGURATIONS Release
54                 RUNTIME DESTINATION bin COMPONENT release_runtimes
55                 LIBRARY DESTINATION lib COMPONENT release_libraries
56                 ARCHIVE DESTINATION lib COMPONENT release_libraries)
58     INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
59                 CONFIGURATIONS Debug
60                 RUNTIME DESTINATION bin COMPONENT debug_runtimes
61                 LIBRARY DESTINATION lib COMPONENT debug_libraries
62                 ARCHIVE DESTINATION lib COMPONENT debug_libraries)
64   ENDIF(BUILD_SHARED_LIBS)
66   IF(BUILD_STATIC_LIBS)
67     ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_ZLIB_SRCS})
68     
69     ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}StaticTarget})
71     SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES
72                           DEBUG_POSTFIX "D")
74     INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget}
75                 CONFIGURATIONS Release
76                 RUNTIME DESTINATION lib COMPONENT release_libraries
77                 LIBRARY DESTINATION lib COMPONENT release_libraries
78                 ARCHIVE DESTINATION lib COMPONENT release_libraries)
80     INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget}
81                 CONFIGURATIONS Debug
82                 RUNTIME DESTINATION lib COMPONENT debug_libraries
83                 LIBRARY DESTINATION lib COMPONENT debug_libraries
84                 ARCHIVE DESTINATION lib COMPONENT debug_libraries)
86   ENDIF(BUILD_STATIC_LIBS)
88   INSTALL(FILES ${OSG_ZLIB_HDR}
89           DESTINATION include${OSG_SUPPORT_INC_SUBDIR}
90           COMPONENT code_headers
91           PERMISSIONS OWNER_WRITE OWNER_READ
92                       GROUP_READ
93                       WORLD_READ)
95   SET(OSG_ZLIB_INCLUDE_DIR ${OSGZLibSrcDir} CACHE PATH "")
96   SET(OSG_ZLIB_STATIC_LIBRARY ${${PROJECT_NAME}StaticTarget} CACHE STRING "")
97   SET(OSG_ZLIB_SHARED_LIBRARY ${${PROJECT_NAME}SharedTarget} CACHE STRING "")
99 ELSE(OSGZLibSrcDir)
100   MESSAGE(STATUS "ignoring zlib")
102   SET(OSGZLibSrcDir "" CACHE PATH "")
103 ENDIF(OSGZLibSrcDir)