FindPthread incorrectly adds -pthread on QNX
On QNX, pthread is part of the standard library. Add the -pthread option will result in a compile error. For example:
cc1plus: error: command line option '-pthread' is valid for the driver but not for C++
In Ubuntu 20.04 (cmake 3.16.3), FindThreads incorrectly adds the -pthread option. Example output:
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
To recreate, build spdlog on Ubuntu 20.04 using the attached toolchain:
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=~/Downloads/qnx_toolchain.cmake -DSPDLOG_BUILD_EXAMPLE=OFF -DSPDLOG_BUILD_TESTS=OFF
Edited by brian soe