Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support cmake threads #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ if(GIT_SHA1_RESULT)
endif(GIT_SHA1_RESULT)
message(STATUS "Current revision: " ${GIT_SHA1})

find_package(Threads)
set(THREADS_LDFLAGS "${CMAKE_THREAD_LIBS_INIT}")
set(THREADS_STATIC_LDFLAGS "${CMAKE_THREAD_LIBS_INIT}")

#-----------------------------------------------------------------------
# Set some options

Expand Down
4 changes: 2 additions & 2 deletions cmake/FindCTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function(target_add_shared_libraries TARGET_NAME LIBRARIES LOCAL_LIBRARIES)
)
endforeach(lib)
foreach(lib ${LOCAL_LIBRARIES})
target_link_libraries(${TARGET_NAME} ${lib}-shared)
target_link_libraries(${TARGET_NAME} ${lib}-shared ${CMAKE_THREADS_LIBS_INIT})
endforeach(lib)
endfunction(target_add_shared_libraries)

Expand All @@ -43,7 +43,7 @@ function(target_add_static_libraries TARGET_NAME LIBRARIES LOCAL_LIBRARIES)
)
endforeach(lib)
foreach(lib ${LOCAL_LIBRARIES})
target_link_libraries(${TARGET_NAME} ${lib}-static)
target_link_libraries(${TARGET_NAME} ${lib}-static ${CMAKE_THREADS_LIBS_INIT})
endforeach(lib)
endfunction(target_add_static_libraries)

Expand Down