diff --git a/CMakeLists.txt b/CMakeLists.txt index 762b1ca..dba6f8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +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 -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.5...3.20) project(boost_system VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) @@ -20,12 +20,14 @@ target_link_libraries(boost_system Boost::winapi ) -file(GLOB_RECURSE boost_system_IDEFILES CONFIGURE_DEPENDS include/*.hpp) -source_group(TREE ${PROJECT_SOURCE_DIR}/include FILES ${boost_system_IDEFILES}) -if (CMAKE_GENERATOR MATCHES "Visual Studio") - list(APPEND boost_system_IDEFILES extra/boost_system.natvis) +if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio") + + file(GLOB_RECURSE boost_system_IDEFILES CONFIGURE_DEPENDS include/*.hpp) + source_group(TREE ${PROJECT_SOURCE_DIR}/include FILES ${boost_system_IDEFILES}) + list(APPEND boost_system_IDEFILES extra/boost_system.natvis) + target_sources(boost_system PRIVATE ${boost_system_IDEFILES}) + endif() -target_sources(boost_system PRIVATE ${boost_system_IDEFILES}) if(BUILD_TESTING)