Skip to content

Commit

Permalink
Platform specific pthread inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
ayberkozgur committed Nov 25, 2014
1 parent a9e45fa commit dfb68de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit dfb68de

Please sign in to comment.