feat(CMakeLists.txt): include cpp14_lang/sized_deallocation.cmake

Previously, it downloaded cpp14_lang/sized_deallocation.cmake file from
Github during cmake was running. This worked in most cases but failed in an
environment where network connection was not provided. A particular
example is to build Ubuntu packages. See [1] for details.

This patch is to include cpp14_lang/sized_deallocation.cmake file in the
repository. It also set COMP_CMAKE_PATH to indicate the location of the
pre-downloaded file. 'CACHE INTERNAL ""' is required to set the scope of
COMP_CMAKE_PATH file so that it's visible inside of
'CompBase.cmake'. See [2] for details.

[1]: https://launchpadlibrarian.net/263258156/buildlog_ubuntu-precise-amd64.lean_0.2.0.20160603023524.gitc73b2860d5211187e9aa1039d1a49dcabdca4292~12.04_BUILDING.txt.gz

[2]: https://cmake.org/cmake/help/v2.8.12/cmake.html#command:set
This commit is contained in:
Soonho Kong 2016-06-03 12:00:43 -04:00
parent c73b2860d5
commit d2b9fd073f
2 changed files with 20 additions and 0 deletions

View file

@ -388,6 +388,7 @@ add_subdirectory(tests/frontends/lean)
add_subdirectory(tests/shell)
# Compatibility Checks using https://github.com/foonathan/compatibility
set(COMP_CMAKE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" CACHE INTERNAL "")
include(CompBase)
comp_target_features(lean PUBLIC cpp14_lang/sized_deallocation)
configure_file("${LEAN_SOURCE_DIR}/compatibility.h.in" "${LEAN_BINARY_DIR}/compatibility.h")

View file

@ -0,0 +1,19 @@
# Copyright (C) 2015-2016 Jonathan Müller <jonathanmueller.dev@gmail.com>
# This file is subject to the license terms in the LICENSE file
# found in the top-level directory of this distribution.
if(NOT COMP_API_VERSION)
message(FATAL_ERROR "needs newer comp_base.cmake version")
endif()
comp_api_version(1)
comp_feature(sized_deallocation
"int main()
{
void *ptr = 0;
::operator delete(ptr, 0);
}" COMP_CPP14_FLAG)
if(COMP_API_VERSION VERSION_GREATER 1.0)
comp_sd6_macro(sized_deallocation __cpp_sized_deallocation 201309)
endif()