Skip to content
Snippets Groups Projects
Commit 0b38424c authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Brad King
Browse files

FindThreads: make the call to try_run() work also if only C++ is enabled

This isn't enough to make the whole module work with only C++ enabled.
parent 9924a212
No related branches found
No related tags found
No related merge requests found
......@@ -91,11 +91,18 @@ macro(_check_pthreads_flag)
# If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
message(STATUS "Check if compiler accepts -pthread")
if(CMAKE_C_COMPILER_LOADED)
set(_threads_src ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c)
elseif(CMAKE_CXX_COMPILER_LOADED)
set(_threads_src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindThreads/CheckForPthreads.cxx)
configure_file(${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c "${_threads_src}" COPYONLY)
endif()
try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c
${_threads_src}
CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
COMPILE_OUTPUT_VARIABLE OUTPUT)
unset(_threads_src)
if(THREADS_HAVE_PTHREAD_ARG)
if(THREADS_PTHREAD_ARG STREQUAL "2")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment