From 297b489b58b36baabc27879d807c674fedc2b655 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 19 Oct 2025 11:00:46 +0300 Subject: [PATCH] Remove the check for the Visual Studio generator; the generator may be Ninja on Windows, and adding the headers to the project may be useful on non-Windows --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45f5f44..403fbe4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ target_link_libraries(boost_assert # Add headers and .natvis to project, for better IDE integration -if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio") +if(CMAKE_VERSION VERSION_GREATER 3.18) # Using target_sources with PRIVATE or PUBLIC on INTERFACE targets requires 3.19 @@ -28,7 +28,12 @@ if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio target_sources(boost_assert PRIVATE ${boost_assert_HEADERS}) unset(boost_assert_HEADERS) - target_sources(boost_assert PUBLIC extra/boost_assert.natvis) + if(MSVC) + + # Only Visual Studio needs this, but the generator may also be Ninja + target_sources(boost_assert PUBLIC extra/boost_assert.natvis) + + endif() endif()