Skip to content

Commit

Permalink
fix pthread linking options
Browse files Browse the repository at this point in the history
  • Loading branch information
i80287 committed Nov 3, 2024
1 parent 38af106 commit 75d58fc
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,20 @@ if(USING_MINGW_GCC)
endif()


if(USE_CPPCHECK_DURING_BUILD AND CMAKE_SYSTEM_NAME MATCHES "Linux")
find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck)
if(CMAKE_CXX_CPPCHECK)
set(CPPCHECK_EXITCODE_ON_ERROR 0)
list(APPEND
CMAKE_CXX_CPPCHECK
"--force"
"--template=gcc"
"--inline-suppr"
)
else()
message(WARNING "Could not find cppcheck")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(USE_CPPCHECK_DURING_BUILD)
find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck)
if(CMAKE_CXX_CPPCHECK)
set(CPPCHECK_EXITCODE_ON_ERROR 0)
list(APPEND
CMAKE_CXX_CPPCHECK
"--force"
"--template=gcc"
"--inline-suppr"
)
else()
message(WARNING "Could not find cppcheck")
endif()
endif()

find_program(LSB_RELEASE_EXEC lsb_release)
Expand All @@ -77,7 +79,7 @@ if(USE_CPPCHECK_DURING_BUILD AND CMAKE_SYSTEM_NAME MATCHES "Linux")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
endif()
if(CMAKE_CXX_CPPCHECK)
if(USE_CPPCHECK_DURING_BUILD AND CMAKE_CXX_CPPCHECK)
if(LSB_DISTRIBUTOR_ID_SHORT STREQUAL "ubuntu" AND LSB_RELEASE_VERSION_SHORT VERSION_GREATER_EQUAL "24.04")
set(CPPCHECK_EXITCODE_ON_ERROR 1)
list(APPEND
Expand All @@ -88,7 +90,7 @@ if(USE_CPPCHECK_DURING_BUILD AND CMAKE_SYSTEM_NAME MATCHES "Linux")
endif()
endif()

if(CMAKE_CXX_CPPCHECK)
if(USE_CPPCHECK_DURING_BUILD AND CMAKE_CXX_CPPCHECK)
list(APPEND
CMAKE_CXX_CPPCHECK
"--error-exitcode=${CPPCHECK_EXITCODE_ON_ERROR}"
Expand Down

0 comments on commit 75d58fc

Please sign in to comment.