|
| 1 | +## --------------------------------------------------------------------- |
| 2 | +## |
| 3 | +## Copyright (C) 2017 by the gint authors |
| 4 | +## |
| 5 | +## This file is part of gint. |
| 6 | +## |
| 7 | +## gint is free software: you can redistribute it and/or modify |
| 8 | +## it under the terms of the GNU General Public License as published |
| 9 | +## by the Free Software Foundation, either version 3 of the License, or |
| 10 | +## (at your option) any later version. |
| 11 | +## |
| 12 | +## gint is distributed in the hope that it will be useful, |
| 13 | +## but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +## GNU General Public License for more details. |
| 16 | +## |
| 17 | +## You should have received a copy of the GNU General Public License |
| 18 | +## along with gint. If not, see <http://www.gnu.org/licenses/>. |
| 19 | +## |
| 20 | +## --------------------------------------------------------------------- |
| 21 | + |
| 22 | +## DO NOT EDIT |
| 23 | +## This file is automatically generated from a file in the repository "gscf". |
| 24 | +## Edit the original and call the script "update_from_sister_repos.sh" instead. |
| 25 | + |
| 26 | +# Finds and sets up lazyten under the target names stored in |
| 27 | +# lazyten_DEBUG_TARGET (Debug version) |
| 28 | +# lazyten_RELEASE_TARGET (Release version) |
| 29 | +# such that just linking against it as a dependency does everything |
| 30 | +# automatically. |
| 31 | +# |
| 32 | +# In case the lazyten library is not found and AUTOCHECKOUT_MISSING_LIBS is set to |
| 33 | +# on, lazyten is automatically checked out and built. |
| 34 | +# Otherwise a fatal error is produced. |
| 35 | +# |
| 36 | + |
| 37 | +# |
| 38 | +# Options and properties required |
| 39 | +# |
| 40 | +option(AUTOCHECKOUT_MISSING_REPOS "Automatically checkout missing repositories" OFF) |
| 41 | + |
| 42 | +# |
| 43 | +# ------- |
| 44 | +# |
| 45 | + |
| 46 | +if (TARGET "${lazyten_DEBUG_TARGET}" OR TARGET "${lazyten_RELEASE_TARGET}") |
| 47 | + message(STATUS "Found lazyten targets, assume lazyten already configured for build.") |
| 48 | + return() |
| 49 | +endif() |
| 50 | + |
| 51 | +# Try to find lazyten somewhere |
| 52 | +find_package(lazyten ${LAZYTEN_VERSION} QUIET CONFIG) |
| 53 | +mark_as_advanced(lazyten_DIR) |
| 54 | + |
| 55 | +if ("${lazyten_DIR}" STREQUAL "lazyten_DIR-NOTFOUND") |
| 56 | + if (AUTOCHECKOUT_MISSING_REPOS) |
| 57 | + execute_process( |
| 58 | + COMMAND "sh" "get_lazyten.sh" |
| 59 | + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/external" |
| 60 | + RESULT_VARIABLE RES |
| 61 | + ) |
| 62 | + if (NOT RES EQUAL 0) |
| 63 | + message(FATAL_ERROR "Getting lazyten from git failed with error: ${RES}") |
| 64 | + endif() |
| 65 | + |
| 66 | + # |
| 67 | + # Proceed to configure lazyten |
| 68 | + # |
| 69 | + add_subdirectory(${PROJECT_SOURCE_DIR}/external/lazyten) |
| 70 | + include_directories(${PROJECT_SOURCE_DIR}/external/lazyten/src) |
| 71 | + include_directories(${PROJECT_BINARY_DIR}/external/lazyten/src) |
| 72 | + |
| 73 | + # Extract version from CMakeLists.txt: |
| 74 | + file(STRINGS "${PROJECT_SOURCE_DIR}/external/lazyten/CMakeLists.txt" |
| 75 | + VERSION_RAW |
| 76 | + REGEX "lazyten VERSION [0-9.]+" |
| 77 | + LIMIT_COUNT 1) |
| 78 | + string(REGEX MATCH "[0-9.]+" GOT_VERSION "${VERSION_RAW}") |
| 79 | + |
| 80 | + # Compare against what is needed |
| 81 | + if("${GOT_VERSION}" VERSION_LESS "${LAZYTEN_VERSION}") |
| 82 | + message(FATAL_ERROR "Inconsistency in the repo: \ |
| 83 | +Version ${LAZYTEN_VERSION} of lazyten was requested, but only version ${GOT_VERSION} \ |
| 84 | +was found.") |
| 85 | + endif() |
| 86 | + |
| 87 | + return() |
| 88 | + endif() |
| 89 | + |
| 90 | + message(FATAL_ERROR "Could not find lazyten library. |
| 91 | +Either provide the installation prefix of the lazyten library in the environment \ |
| 92 | +variable lazyten_DIR or enable autocheckout via -DAUTOCHECKOUT_MISSING_REPOS=ON.") |
| 93 | +endif() |
| 94 | + |
| 95 | +#TODO test and remove (same below in #old#) |
| 96 | +message(WARNING "This part of findLazyten has never been tested.") |
| 97 | + |
| 98 | +# Setup library targets |
| 99 | +set(lazyten_DEBUG_TARGET "Upstream::lazyten.g" |
| 100 | + CACHE INTERNAL "Target name of debug version of lazyten") |
| 101 | +set(lazyten_RELEASE_TARGET "Upstream::lazyten" |
| 102 | + CACHE INTERNAL "Target name of release version of lazyten") |
| 103 | + |
| 104 | +# Check that all required targets are available. |
| 105 | +foreach(build ${DRB_BUILD_TYPES}) |
| 106 | + if(NOT TARGET "${lazyten_${build}_TARGET}") |
| 107 | + message(FATAL_ERROR "We could not find a ${build} version of lazyten at this location. \ |
| 108 | + Either disable building a ${build} version of ${CMAKE_PROJECT_NAME} or else \ |
| 109 | + rebuild lazyten with a ${build} version as well.") |
| 110 | + endif() |
| 111 | +endforeach() |
| 112 | + |
| 113 | +#TODO check that we don't need this extra stuff: |
| 114 | +#old## Now we found the library. Most of the times that's it and we are done. |
| 115 | +#old## But if we got the lazyten from a build directory, then it is very |
| 116 | +#old## likely that the header includes cannot be found like this. |
| 117 | +#old# |
| 118 | +#old## Find dir containing lazyten config: |
| 119 | +#old#get_filename_component(lazyten_config_dir "${lazyten_CONFIG}" DIRECTORY) |
| 120 | +#old# |
| 121 | +#old#set(lazyten_DEBUG_TARGET "Upstream::lazyten.g" |
| 122 | +#old# CACHE INTERNAL "Target name of debug version of lazyten") |
| 123 | +#old#set(lazyten_RELEASE_TARGET "Upstream::lazyten" |
| 124 | +#old# CACHE INTERNAL "Target name of release version of lazyten") |
| 125 | +#old# |
| 126 | +#old## So we try to correct this for all existing targets: |
| 127 | +#old#foreach(target ${lazyten_DEBUG_TARGET} ${lazyten_RELEASE_TARGET}) |
| 128 | +#old# if (NOT TARGET ${target}) |
| 129 | +#old# continue() |
| 130 | +#old# endif() |
| 131 | +#old# |
| 132 | +#old# # Check that the includes are present: |
| 133 | +#old# get_target_property(LAZYTEN_INTERFACE_INCLUDES |
| 134 | +#old# ${target} INTERFACE_INCLUDE_DIRECTORIES) |
| 135 | +#old# |
| 136 | +#old# # If yes continue |
| 137 | +#old# if(NOT "${LAZYTEN_INTERFACE_INCLUDES}" |
| 138 | +#old# STREQUAL "LAZYTEN_INTERFACE_INCLUDES-NOTFOUND") |
| 139 | +#old# continue() |
| 140 | +#old# endif() |
| 141 | +#old# |
| 142 | +#old# set(LAZYTEN_INTERFACE_INCLUDES "") |
| 143 | +#old# |
| 144 | +#old# # Try to find the include dirctory: |
| 145 | +#old# find_path(lazyten_INCLUDE_DIR "lazyten/version.hh" |
| 146 | +#old# HINTS |
| 147 | +#old# # If we found a build directory, then this is the |
| 148 | +#old# # path to the include directory |
| 149 | +#old# ${lazyten_config_dir}/../src/ |
| 150 | +#old# PATHS |
| 151 | +#old# $ENV{lazyten_INCLUDE_DIR} |
| 152 | +#old# ${PROJECT_SOURCE_DIR}/../lazyten/src |
| 153 | +#old# DOC "lazyten header include directory" |
| 154 | +#old# ) |
| 155 | +#old# |
| 156 | +#old# # Check that the include directory was found |
| 157 | +#old# if ("${lazyten_INCLUDE_DIR}" STREQUAL "lazyten_INCLUDE_DIR-NOTFOUND") |
| 158 | +#old# message(FATAL_ERROR "Could not find lazyten include directory. |
| 159 | +#old#Please provide a hint using the environment variable lazyten_INCLUDE_DIR") |
| 160 | +#old# endif() |
| 161 | +#old# |
| 162 | +#old# # Append to interface includes: |
| 163 | +#old# set(LAZYTEN_INTERFACE_INCLUDES ${LAZYTEN_INTERFACE_INCLUDES} ${lazyten_INCLUDE_DIR}) |
| 164 | +#old# |
| 165 | +#old# # Check that the lazyten/version_defs.hh file can be found in this include |
| 166 | +#old# # directory. |
| 167 | +#old# if(NOT EXISTS "${lazyten_INCLUDE_DIR}/lazyten/version_defs.hh") |
| 168 | +#old# if(EXISTS "${lazyten_config_dir}/src/lazyten/version_defs.hh") |
| 169 | +#old# set(LAZYTEN_INTERFACE_INCLUDES ${LAZYTEN_INTERFACE_INCLUDES} |
| 170 | +#old# "${lazyten_config_dir}/src" |
| 171 | +#old# ) |
| 172 | +#old# else() |
| 173 | +#old# message(FATAL_ERROR "Could not find lazyten version_defs.hh file") |
| 174 | +#old# endif() |
| 175 | +#old# endif() |
| 176 | +#old# |
| 177 | +#old# # Set the interface includes: |
| 178 | +#old# set_target_properties(${target} |
| 179 | +#old# PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LAZYTEN_INTERFACE_INCLUDES}" |
| 180 | +#old# ) |
| 181 | +#old#endforeach() |
| 182 | + |
| 183 | +message(STATUS "Found lazyten config at ${lazyten_CONFIG}") |
0 commit comments