Allow overriding the default install locations for cmake.

This commit is contained in:
Christoph J. Thompson 2012-03-11 10:15:31 +01:00 committed by Mark Adler
parent 5d5befa4c3
commit f8867924c1
1 changed files with 10 additions and 5 deletions

View File

@ -3,6 +3,11 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C) project(zlib C)
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
if(NOT DEFINED BUILD_SHARED_LIBS) if(NOT DEFINED BUILD_SHARED_LIBS)
option(BUILD_SHARED_LIBS "Build a shared library form of zlib" ON) option(BUILD_SHARED_LIBS "Build a shared library form of zlib" ON)
endif() endif()
@ -165,15 +170,15 @@ endif()
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
install(TARGETS zlib install(TARGETS zlib
RUNTIME DESTINATION bin RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION lib ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION lib ) LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
endif() endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION include) install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
endif() endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES zlib.3 DESTINATION share/man/man3) install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
endif() endif()
#============================================================================ #============================================================================