summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2015-09-22 03:23:12 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-25 14:08:05 (GMT)
commit9924a212f671dfcc2b20d2a29da23bc440247f19 (patch)
tree80b8cce77389551d8e010bee06fbdefd0b3e8177 /Modules
parenta27bc0ccacff7bc590ace2ce941f0552d05fd14c (diff)
downloadCMake-9924a212f671dfcc2b20d2a29da23bc440247f19.zip
CMake-9924a212f671dfcc2b20d2a29da23bc440247f19.tar.gz
CMake-9924a212f671dfcc2b20d2a29da23bc440247f19.tar.bz2
FindThreads: replace CheckIncludeFiles by CheckIncludeFile
While at it, also add a branch using CheckIncludeFileCXX. Also give a better error message if no supported language is enabled. C++ support isn't working yet, but it has never worked.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindThreads.cmake18
1 files changed, 15 insertions, 3 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index a0bc4d1..88da7c5 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -39,7 +39,7 @@
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
-# Copyright 2011-2014 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2011-2015 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -51,15 +51,23 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include (CheckIncludeFiles)
include (CheckLibraryExists)
include (CheckSymbolExists)
set(Threads_FOUND FALSE)
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY})
+if(CMAKE_C_COMPILER_LOADED)
+ include (CheckIncludeFile)
+elseif(CMAKE_CXX_COMPILER_LOADED)
+ include (CheckIncludeFileCXX)
+else()
+ message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled")
+endif()
+
# Do we have sproc?
if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
+ include (CheckIncludeFiles)
CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
endif()
@@ -120,7 +128,11 @@ if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
set(CMAKE_USE_SPROC_INIT 1)
else()
# Do we have pthreads?
- CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ if(CMAKE_C_COMPILER_LOADED)
+ CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ else()
+ CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ endif()
if(CMAKE_HAVE_PTHREAD_H)
#