Skip to content

Commit 08b73f7

Browse files
authored
Merge pull request cpp-best-practices#18 from valerioformato/master
Fix compiler detection for AppleClang and compiler flags for catch_ma…
2 parents 62d964c + ed90734 commit 08b73f7

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

cmake/CompilerWarnings.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function(set_project_warnings project_name)
7979

8080
if(MSVC)
8181
set(PROJECT_WARNINGS ${MSVC_WARNINGS})
82-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
82+
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
8383
set(PROJECT_WARNINGS ${CLANG_WARNINGS})
8484
else()
8585
set(PROJECT_WARNINGS ${GCC_WARNINGS})

cmake/Sanitizers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function(enable_sanitizers project_name)
22

3-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL
4-
"Clang")
3+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
4+
".*Clang")
55
option(ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" FALSE)
66

77
if(ENABLE_COVERAGE)

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ endif()
88

99
add_library(catch_main STATIC catch_main.cpp)
1010
target_link_libraries(catch_main PUBLIC CONAN_PKG::catch2)
11+
target_link_libraries(catch_main PRIVATE project_options)
1112

1213
add_executable(tests tests.cpp)
1314
target_link_libraries(tests PRIVATE project_warnings project_options

0 commit comments

Comments
 (0)