From 10a59e61a5b1b5f74d07bff9732a97dd8700a22f Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Mon, 9 Sep 2024 19:39:43 -0300 Subject: [PATCH] Don't force CMAKE_CXX_FLAGS changes when not top-level --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68b53436a..33c334b3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,8 +103,7 @@ if(CPR_ENABLE_CPPCHECK) include(cmake/cppcheck.cmake) endif() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") -else() +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") endif()