Repository: nifi-minifi-cpp Updated Branches: refs/heads/master 94253ffdc -> 05838e51f
JIRA MINIFI-123. On the Raspbian platform (Debian based) the linker is unsuccessful in linking pthreads with the MiNiFi executable because CMake does not create a makefile that specifies -lpthreads. The following change should create a platform agnostic way of making sure posix threads are linked correctly. This change should be compatible with CMake 2.8.x and above. This closes #22. Signed-off-by: Aldrin Piri <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/05838e51 Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/05838e51 Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/05838e51 Branch: refs/heads/master Commit: 05838e51faf6a768dfd205ff90b1b4d99e3661cf Parents: 94253ff Author: codingogre <[email protected]> Authored: Thu Oct 20 23:28:10 2016 +0000 Committer: Aldrin Piri <[email protected]> Committed: Fri Nov 4 11:16:59 2016 -0400 ---------------------------------------------------------------------- main/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/05838e51/main/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index e740955..f083a4c 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -34,6 +34,12 @@ else () endif (LIBXML2_FOUND) add_executable(minifiexe MiNiFiMain.cpp) +if(THREADS_HAVE_PTHREAD_ARG) + target_compile_options(PUBLIC minifiexe "-pthread") +endif() +if(CMAKE_THREAD_LIBS_INIT) + target_link_libraries(minifiexe "${CMAKE_THREAD_LIBS_INIT}") +endif() # Link against minifi, yaml-cpp and uuid target_link_libraries(minifiexe minifi yaml-cpp uuid)
