Disable installation without PROJECT_VERSION; add comments; fix indentation

This commit is contained in:
Peter Dimov
2019-12-27 04:00:29 +02:00
parent 9d8eda7972
commit da5e091413

View File

@@ -2,9 +2,7 @@
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
# Partial and experimental CMake support # We support CMake 3.5, but prefer 3.16 policies and behavior
# Subject to change; please do not rely on the contents of this file yet
cmake_minimum_required(VERSION 3.5...3.16) cmake_minimum_required(VERSION 3.5...3.16)
project(boost_assert VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) project(boost_assert VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
@@ -15,20 +13,24 @@ add_library(Boost::assert ALIAS boost_assert)
target_include_directories(boost_assert INTERFACE include) target_include_directories(boost_assert INTERFACE include)
target_link_libraries(boost_assert target_link_libraries(boost_assert
INTERFACE INTERFACE
Boost::config Boost::config
) )
include(BoostInstall OPTIONAL RESULT_VARIABLE HAVE_BOOST_INSTALL) # boost_install requires PROJECT_VERSION
# Without the superproject, we don't have any, so skip installation
if(HAVE_BOOST_INSTALL) if(BOOST_SUPERPROJECT_VERSION)
boost_install(TARGETS boost_assert HEADER_DIRECTORY include/) include(BoostInstall)
boost_install(TARGETS boost_assert HEADER_DIRECTORY include/)
endif() endif()
# BUILD_TESTING is the standard CTest variable that enables testing
if(BUILD_TESTING) if(BUILD_TESTING)
add_subdirectory(test) add_subdirectory(test)
endif() endif()