From dfb68de42cdb60f8c3c7d9dfb4728db8de49a2c9 Mon Sep 17 00:00:00 2001 From: ayberkozgur Date: Tue, 25 Nov 2014 10:32:05 +0100 Subject: [PATCH] Platform specific pthread inclusion --- CMakeLists.txt | 6 +++++- src/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8deba8f..c1b205e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,13 +36,13 @@ message(STATUS "OpenCV version: ${OpenCV_VERSION}") ## Options ### ########################################## -option(WITH_PTHREADS "Multithreading support with pthreads" ON) option(WITH_SAMPLES "Build demos" OFF) option(WITH_TESTS "Build tests" OFF) option(WITH_JNI_BINDINGS "Build JNI bindings compatible with ordinary Java and Android" OFF) option(ANDROID_INSTALL_LIBRARIES "Install the chilitag libraries inside project at ANDROID_PROJECT_ROOT" OFF) if(DEFINED ANDROID) #OPENCV has a nice macro for this: OCV_OPTION, consider using it. + option(WITH_PTHREADS "Multithreading support with pthreads" ON) option(WITH_TOOLS "provides the marker generation tool" OFF) #Set Android install path @@ -61,7 +61,11 @@ if(DEFINED ANDROID) #OPENCV has a nice macro for this: OCV_OPTION, consider usin if(NOT DEFINED ENV{ANDROID_TOOLCHAIN_NAME}) message(FATAL_ERROR "Please define the ANDROID_TOOLCHAIN_NAME environment variable first, e.g arm-linux-androideabi-4.8") endif() +elseif(UNIX) + option(WITH_PTHREADS "Multithreading support with pthreads" ON) + option(WITH_TOOLS "provides the marker generation tool" ON) else() + option(WITH_PTHREADS "Multithreading support with pthreads" OFF) option(WITH_TOOLS "provides the marker generation tool" ON) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a683943..9a81a73 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,7 +34,7 @@ add_library( target_link_libraries(chilitags ${OpenCV_LIBS}) target_link_libraries(chilitags_static ${OpenCV_LIBS}) -if(WITH_PTHREADS) +if(WITH_PTHREADS AND NOT DEFINED ANDROID) #Android pthreads don't require -lpthread target_link_libraries(chilitags pthread) target_link_libraries(chilitags_static pthread) endif()