evmc/bootstrap.cmake
Paweł Bylica 384993348d Squashed 'cmake/cable/' changes from cea3a65..945b7e5
945b7e5 Cable 0.4.3
1885e7e CablePackage: Add support for source packages
3fc90c6 Cable 0.4.2
9b84efe buildinfo: Generate version.h header with project version string
93a47b2 Cable 0.4.1
f3e0f53 Add CablePackage for building archive packages
9708939 Use -Wpedantic instead of -pedantic
7e0e2b6 Add 32-bit toolchains

git-subtree-dir: cmake/cable
git-subtree-split: 945b7e5e3ca2f888c6e62747f82e2aad413b823c
2019-08-12 11:22:04 +02:00

72 lines
2.0 KiB
CMake

# Cable: CMake Bootstrap Library.
# Copyright 2019 Pawel Bylica.
# Licensed under the Apache License, Version 2.0.
# Bootstrap the Cable - CMake Bootstrap Library by including this file.
# e.g. include(cmake/cable/bootstrap.cmake).
# Cable version.
#
# This is internal variable automatically updated with external tools.
# Use CABLE_VERSION variable if you need this information.
set(version 0.4.3)
# For convenience, add the project CMake module dir to module path.
set(module_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if(EXISTS ${module_dir})
list(APPEND CMAKE_MODULE_PATH ${module_dir})
endif()
if(CABLE_VERSION)
# Some other instance of Cable has been initialized in the top project.
# Mark this project as nested.
set(PROJECT_IS_NESTED TRUE)
# Compare versions of the top project and this instances.
if(CABLE_VERSION VERSION_LESS version)
set(comment " (version older than ${version})")
elseif(CABLE_VERSION VERSION_GREATER version)
set(comment " (version newer than ${version})")
endif()
# Log information about initialization in the top project.
file(RELATIVE_PATH subproject_dir ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
cable_debug("${subproject_dir}: Cable ${CABLE_VERSION}${comment} already initialized in the top project")
cable_debug("Project CMake modules directory: ${module_dir}")
unset(version)
unset(module_dir)
unset(comment)
return()
endif()
option(CABLE_DEBUG "Enable Cable debug logs" OFF)
function(cable_log)
message(STATUS "[cable ] ${ARGN}")
endfunction()
function(cable_debug)
if(CABLE_DEBUG)
message(STATUS "[cable*] ${ARGN}")
endif()
endfunction()
# Export Cable version.
set(CABLE_VERSION ${version})
# Mark this project as non-nested.
set(PROJECT_IS_NESTED FALSE)
# Add Cable modules to the CMake module path.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
cable_log("Cable ${CABLE_VERSION} initialized")
cable_debug("Project CMake modules directory: ${module_dir}")
unset(version)
unset(module_dir)