|
| 1 | +############################################################################### |
| 2 | +# Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. |
| 3 | +# |
| 4 | +# Produced at the Lawrence Livermore National Laboratory |
| 5 | +# |
| 6 | +# LLNL-CODE-716457 |
| 7 | +# |
| 8 | +# All rights reserved. |
| 9 | +# |
| 10 | +# Please also read ascent/LICENSE |
| 11 | +# |
| 12 | +# Redistribution and use in source and binary forms, with or without |
| 13 | +# modification, are permitted provided that the following conditions are met: |
| 14 | +# |
| 15 | +# * Redistributions of source code must retain the above copyright notice, |
| 16 | +# this list of conditions and the disclaimer below. |
| 17 | +# |
| 18 | +# * Redistributions in binary form must reproduce the above copyright notice, |
| 19 | +# this list of conditions and the disclaimer (as noted below) in the |
| 20 | +# documentation and/or other materials provided with the distribution. |
| 21 | +# |
| 22 | +# * Neither the name of the LLNS/LLNL nor the names of its contributors may |
| 23 | +# be used to endorse or promote products derived from this software without |
| 24 | +# specific prior written permission. |
| 25 | +# |
| 26 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 27 | +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 28 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 29 | +# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, |
| 30 | +# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY |
| 31 | +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 32 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 33 | +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 34 | +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 35 | +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 36 | +# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 37 | +# POSSIBILITY OF SUCH DAMAGE. |
| 38 | +# |
| 39 | +############################################################################### |
| 40 | + |
| 41 | + |
| 42 | +############################################################################### |
| 43 | +# |
| 44 | +# file: src/config/CMakeLists.txt |
| 45 | +# |
| 46 | +############################################################################### |
| 47 | + |
| 48 | +############################################################################### |
| 49 | +# export everything for a cmake build to be able to import with find_package |
| 50 | +############################################################################### |
| 51 | + |
| 52 | +if (NOT DEFINED APCOMP_INSTALL_INCLUDE_DIR) |
| 53 | + set(APCOMP_INSTALL_INCLUDE_DIR "include") |
| 54 | +endif() |
| 55 | + |
| 56 | +if (NOT DEFINED APCOMP_INSTALL_CONFIG_DIR) |
| 57 | + set(APCOMP_INSTALL_CONFIG_DIR "lib") |
| 58 | +endif() |
| 59 | + |
| 60 | +if (NOT DEFINED APCOMP_INSTALL_LIB_DIR) |
| 61 | + set(APCOMP_INSTALL_LIB_DIR "lib") |
| 62 | +endif() |
| 63 | + |
| 64 | +if (NOT DEFINED APCOMP_INSTALL_BIN_DIR) |
| 65 | + set(APCOMP_INSTALL_BIN_DIR "bin") |
| 66 | +endif() |
| 67 | + |
| 68 | +if (NOT DEFINED APCOMP_INSTALL_SHARED_RESOURCES_DIR) |
| 69 | + set(APCOMP_INSTALL_SHARED_RESOURCES_DIR "share/apcomp") |
| 70 | +endif() |
| 71 | + |
| 72 | +if (NOT DEFINED APCOMP_INSTALL_CMAKE_MODULE_DIR) |
| 73 | + set(APCOMP_INSTALL_CMAKE_MODULE_DIR "${APCOMP_INSTALL_CONFIG_DIR}/cmake") |
| 74 | +endif() |
| 75 | + |
| 76 | +include(CMakePackageConfigHelpers) |
| 77 | + |
| 78 | +# write version heler |
| 79 | +write_basic_package_version_file( |
| 80 | + ${CMAKE_CURRENT_BINARY_DIR}/APCompConfigVersion.cmake |
| 81 | + VERSION ${PROJECT_VERSION} |
| 82 | + COMPATIBILITY AnyNewerVersion |
| 83 | +) |
| 84 | + |
| 85 | + |
| 86 | +# write cmake package config file |
| 87 | +configure_package_config_file( |
| 88 | + APCompConfig.cmake.in |
| 89 | + ${CMAKE_CURRENT_BINARY_DIR}/APCompConfig.cmake |
| 90 | + INSTALL_DESTINATION ${APCOMP_INSTALL_CONFIG_DIR} |
| 91 | + PATH_VARS |
| 92 | + APCOMP_INSTALL_INCLUDE_DIR |
| 93 | + APCOMP_INSTALL_LIB_DIR |
| 94 | + APCOMP_INSTALL_BIN_DIR |
| 95 | + APCOMP_INSTALL_SHARED_RESOURCES_DIR |
| 96 | + APCOMP_INSTALL_CMAKE_MODULE_DIR |
| 97 | + ) |
| 98 | + |
| 99 | + |
| 100 | +# install everything needed |
| 101 | +install(FILES |
| 102 | + ${CMAKE_CURRENT_BINARY_DIR}/APCompConfig.cmake |
| 103 | + ${CMAKE_CURRENT_BINARY_DIR}/APCompConfigVersion.cmake |
| 104 | + DESTINATION ${APCOMP_INSTALL_CMAKE_MODULE_DIR}) |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
0 commit comments