[cmake-developers] [CMake 0014836]: find_package(Threads) fails on Mac OS X with Xcode 5.1.

Mantis Bug Tracker mantis at public.kitware.com
Tue Mar 25 13:10:41 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14836 
====================================================================== 
Reported By:                Michael Priestman
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14836
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-03-25 13:10 EDT
Last Modified:              2014-03-25 13:10 EDT
====================================================================== 
Summary:                    find_package(Threads) fails on Mac OS X with Xcode
5.1.
Description: 
When CMake tries to find the threading libraries using find_package(Threads), it
will fail on Mac OS X and Xcode 5.1.

It works fine with Xcode 5.0.

Steps to Reproduce: 
To reproduce, put the following in a basic CMakeLists.txt file:

--- Begin CMakeLists.txt ---
cmake_minimum_required(VERSION 2.8)
project(Test)
find_package(Threads REQUIRED)
--- End CMakeLists.txt ---

then run:

cmake -G "Xcode"

You get the following output:

-- The C compiler identification is Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.0
-- Looking for include file pthread.h
CMake Error at /Applications/CMake
2.8-12.app/Contents/share/cmake-2.8/Modules/CMakeCInformation.cmake:37
(get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)


CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Looking for include file pthread.h - not found
CMake Error at /Applications/CMake
2.8-12.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108
(message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /Applications/CMake
2.8-12.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315
(_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake
2.8-12.app/Contents/share/cmake-2.8/Modules/FindThreads.cmake:166
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!


Additional Information: 
This was working fine for us up until we upgraded to Xcode 5.1. Could it be just
looking in the wrong place for pthread.h?

The strange thing is that if you just create a basic C file that includes
<pthread.h>, it compiles fine in Xcode, so just sure what is going wrong here.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-03-25 13:10 Michael PriestmanNew Issue                                    
======================================================================



More information about the cmake-developers mailing list