diff --git a/CMakeLists.txt b/CMakeLists.txt index f9f8dc2..0066aeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,7 @@ # 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 -# Partial and experimental CMake support -# Subject to change; please do not rely on the contents of this file yet - +# We support CMake 3.5, but prefer 3.16 policies and behavior cmake_minimum_required(VERSION 3.5...3.16) 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_link_libraries(boost_assert - INTERFACE - Boost::config + INTERFACE + 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() +# BUILD_TESTING is the standard CTest variable that enables testing + if(BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif()