#101 Enable C language again as long as FindThreads requires it
This avoids having patched CMake modules in the source tree of the gflags library. Usually a C compiler is installed along a C++ compiler (or it is used for C as well). The only slight downside is the extra configuration time needed by CMake to check the C compiler.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1272770..275426d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,14 @@
set (PACKAGE_BUGREPORT "https://github.com/schuhschuh/gflags/issues")
project (${PACKAGE_NAME} CXX)
+if (CMAKE_VERSION VERSION_LESS 100)
+ # C language still needed because the following required CMake modules
+ # (or their dependencies, respectively) are not correctly handling
+ # the case where only CXX is enabled.
+ # - CheckTypeSize.cmake (fixed in CMake 3.1, cf. http://www.cmake.org/Bug/view.php?id=14056)
+ # - FindThreads.cmake (--> CheckIncludeFiles.cmake <--)
+ enable_language (C)
+endif ()
version_numbers (
${PACKAGE_VERSION}
@@ -179,7 +187,7 @@
endif ()
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
-find_package (ThreadsCXX)
+find_package (Threads)
if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
set (HAVE_PTHREAD 1)
check_type_size (pthread_rwlock_t RWLOCK LANGUAGE CXX)