1 | cmake_minimum_required(VERSION 2.8)
|
---|
2 |
|
---|
3 | project(lib3dv)
|
---|
4 |
|
---|
5 | set(PACKAGE_NAME "lib3dv")
|
---|
6 | set(PACKAGE_VERSION_MAJOR 1)
|
---|
7 | set(PACKAGE_VERSION_MINOR 2)
|
---|
8 | set(PACKAGE_VERSION_PATCH 0)
|
---|
9 |
|
---|
10 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
---|
11 |
|
---|
12 | # install locations definition
|
---|
13 |
|
---|
14 | if(NOT INCLUDE_INSTALL_DIR)
|
---|
15 | set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/${PACKAGE_NAME})
|
---|
16 | endif()
|
---|
17 |
|
---|
18 | if(NOT LIBRARY_INSTALL_DIR)
|
---|
19 | set(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
---|
20 | endif()
|
---|
21 |
|
---|
22 | if(NOT BINARY_INSTALL_DIR)
|
---|
23 | set(BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
|
---|
24 | endif()
|
---|
25 |
|
---|
26 | if(NOT DOCUMENTATION_INSTALL_DIR)
|
---|
27 | if(WIN32)
|
---|
28 | set(DOCUMENTATION_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/doc)
|
---|
29 | else()
|
---|
30 | set(DOCUMENTATION_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/${PACKAGE_NAME})
|
---|
31 | endif()
|
---|
32 | endif()
|
---|
33 |
|
---|
34 | if(NOT MODULES_INSTALL_DIR)
|
---|
35 | if(WIN32)
|
---|
36 | set(MODULES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/cmake)
|
---|
37 | else()
|
---|
38 | set(MODULES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/${PACKAGE_NAME})
|
---|
39 | endif()
|
---|
40 | endif()
|
---|
41 |
|
---|
42 | # Make relative paths absolute (needed later on)
|
---|
43 | foreach(p LIBRARY BINARY INCLUDE MODULES)
|
---|
44 | set(var ${p}_INSTALL_DIR)
|
---|
45 | if(NOT IS_ABSOLUTE "${${var}}")
|
---|
46 | set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
---|
47 | endif()
|
---|
48 | endforeach()
|
---|
49 |
|
---|
50 | add_subdirectory(doc)
|
---|
51 | add_subdirectory(lib3dv)
|
---|
52 |
|
---|
53 | # Export the package for use from the build-tree
|
---|
54 | # (this registers the build-tree with a global CMake-registry)
|
---|
55 | export(PACKAGE Lib3DV)
|
---|
56 |
|
---|
57 | # Create the Lib3DVConfig.cmake and Lib3DVConfigVersion files
|
---|
58 | file(RELATIVE_PATH REL_INCLUDE_DIR "${MODULES_INSTALL_DIR}" "${INCLUDE_INSTALL_DIR}")
|
---|
59 | # ... for the build tree
|
---|
60 | set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
|
---|
61 | configure_file(cmake/Lib3DVConfig.cmake.in "${PROJECT_BINARY_DIR}/Lib3DVConfig.cmake" @ONLY)
|
---|
62 | # ... for the install tree
|
---|
63 | set(CONF_INCLUDE_DIRS "\${LIB3DV_CMAKE_DIR}/${REL_INCLUDE_DIR}/..")
|
---|
64 | configure_file(cmake/Lib3DVConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Lib3DVConfig.cmake" @ONLY)
|
---|
65 | # ... for both
|
---|
66 | configure_file(cmake/Lib3DVConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/Lib3DVConfigVersion.cmake" @ONLY)
|
---|
67 |
|
---|
68 | # Install the Lib3DVConfig.cmake and Lib3DVConfigVersion.cmake
|
---|
69 | install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Lib3DVConfig.cmake" "${PROJECT_BINARY_DIR}/Lib3DVConfigVersion.cmake" DESTINATION "${MODULES_INSTALL_DIR}" COMPONENT dev)
|
---|
70 |
|
---|
71 | # Install the export set for use with the install-tree
|
---|
72 | install(EXPORT Lib3DVTargets DESTINATION "${MODULES_INSTALL_DIR}" COMPONENT dev)
|
---|
73 |
|
---|
74 |
|
---|