Skip to content

Commit 4b5fba1

Browse files
authored
added CMake option CPPCHK_GLIBCXX_DEBUG to make usage of _GLIBCXX_DEBUG in Debug build configurable (cppcheck-opensource#3628)
1 parent 184ef4e commit 4b5fba1

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/clang-tidy.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ jobs:
3838
run: |
3939
mkdir cmake.output
4040
cd cmake.output
41-
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On ..
41+
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off ..
4242
cd ..
4343
44-
- name: Clang-Tidy
44+
- name: Prepare CMake dependencies
4545
run: |
4646
# make sure the precompiled headers exist
4747
make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx
4848
make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx
49+
# make sure the auto-generated GUI sources exist
4950
make -C cmake.output autogen
51+
52+
- name: Clang-Tidy
53+
run: |
5054
cmake --build cmake.output --target run-clang-tidy 2> /dev/null

cmake/compilerDefinitions.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ if (MSVC)
77
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
88
endif()
99

10-
if (UNIX)
10+
# TODO: this should probably apply to the compiler and not the platform
11+
if (CPPCHK_GLIBCXX_DEBUG AND UNIX)
1112
# TODO: check if this can be enabled again for Clang - also done in Makefile
1213
if (CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
1314
add_definitions(-D_GLIBCXX_DEBUG)

cmake/options.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ option(WITH_QCHART "When building GUI(need BUILD_GUI=ON), use Qt5 Chart
4242
option(HAVE_RULES "Usage of rules (needs PCRE library and headers)" OFF)
4343
option(USE_Z3 "Usage of z3 library" OFF)
4444
option(USE_BUNDLED_TINYXML2 "Usage of bundled tinyxml2 library" ON)
45+
option(CPPCHK_GLIBCXX_DEBUG "Usage of _GLIBCXX_DEBUG in Debug build" ON)
4546

4647
if (CMAKE_VERSION VERSION_EQUAL "3.16" OR CMAKE_VERSION VERSION_GREATER "3.16")
4748
set(CMAKE_DISABLE_PRECOMPILE_HEADERS Off CACHE BOOL "Disable precompiled headers")

0 commit comments

Comments
 (0)