cmake_minimum_required(VERSION 2.8) project(lib3dv) set(PACKAGE_NAME "lib3dv") set(PACKAGE_VERSION_MAJOR 1) set(PACKAGE_VERSION_MINOR 2) set(PACKAGE_VERSION_PATCH 0) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # install locations definition if(NOT INCLUDE_INSTALL_DIR) set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/${PACKAGE_NAME}) endif() if(NOT LIBRARY_INSTALL_DIR) set(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib) endif() if(NOT BINARY_INSTALL_DIR) set(BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin) endif() if(NOT DOCUMENTATION_INSTALL_DIR) if(WIN32) set(DOCUMENTATION_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/doc) else() set(DOCUMENTATION_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/${PACKAGE_NAME}) endif() endif() if(NOT MODULES_INSTALL_DIR) if(WIN32) set(MODULES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/cmake) else() set(MODULES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/${PACKAGE_NAME}) endif() endif() # Make relative paths absolute (needed later on) foreach(p LIBRARY BINARY INCLUDE MODULES) set(var ${p}_INSTALL_DIR) if(NOT IS_ABSOLUTE "${${var}}") set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() endforeach() add_subdirectory(doc) add_subdirectory(lib3dv) # Export the package for use from the build-tree # (this registers the build-tree with a global CMake-registry) export(PACKAGE Lib3DV) # Create the Lib3DVConfig.cmake and Lib3DVConfigVersion files file(RELATIVE_PATH REL_INCLUDE_DIR "${MODULES_INSTALL_DIR}" "${INCLUDE_INSTALL_DIR}") # ... for the build tree set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") configure_file(cmake/Lib3DVConfig.cmake.in "${PROJECT_BINARY_DIR}/Lib3DVConfig.cmake" @ONLY) # ... for the install tree set(CONF_INCLUDE_DIRS "\${LIB3DV_CMAKE_DIR}/${REL_INCLUDE_DIR}/..") configure_file(cmake/Lib3DVConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Lib3DVConfig.cmake" @ONLY) # ... for both configure_file(cmake/Lib3DVConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/Lib3DVConfigVersion.cmake" @ONLY) # Install the Lib3DVConfig.cmake and Lib3DVConfigVersion.cmake install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Lib3DVConfig.cmake" "${PROJECT_BINARY_DIR}/Lib3DVConfigVersion.cmake" DESTINATION "${MODULES_INSTALL_DIR}" COMPONENT dev) # Install the export set for use with the install-tree install(EXPORT Lib3DVTargets DESTINATION "${MODULES_INSTALL_DIR}" COMPONENT dev)