Skip to content

Commit

Permalink
Change where thread support is detected to avoid using a new cmake fe…
Browse files Browse the repository at this point in the history
…ature

Propagating library use to the global level is a newer cmake feature and
doesn't work reliably when included as a sub-project anyway. Remove this
and do the normal "find it at the top level" step inside the included
setup

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Sep 14, 2019
1 parent 1bd7e84 commit d98a542
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 0 additions & 5 deletions IlmBase/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ if(ILMBASE_HAVE_UCONTEXT_H)
endif()
endif()

# so we know how to link / use...
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
###check_include_files(pthread.h ILMBASE_HAVE_PTHREAD)
if(Threads_FOUND)
set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE)
if(CMAKE_HAVE_PTHREAD_H OR CMAKE_USE_PTHREADS_INIT OR CMAKE_HP_PTHREAD_INIT)
set(ILMBASE_HAVE_PTHREAD ON)
# TODO: remove this once we cleanly have ILMBASE_ prefix on all #defines
Expand Down
14 changes: 14 additions & 0 deletions IlmBase/config/IlmBaseSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,17 @@ if(OPENEXR_USE_CLANG_TIDY)
-checks=*;
)
endif()

###############################
# Dependent libraries

# so we know how to link / use threads and don't have to have a -pthread
# everywhere...
if(NOT TARGET Threads::Threads)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
if(NOT Threads_FOUND)
message(FATAL_ERROR "Unable to find a threading library which is required for IlmThread")
endif()
endif()

0 comments on commit d98a542

Please sign in to comment.