Hello,

Here come two packages to find OpenThreads. They work fine for me on on KUbuntu 7.04 with OpenThreads 1.2, YMMV.

--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to the amount of work, I usually need 10 days to answer)




# Find the OpenThreads includes and library
#
# OpenThreads_INCLUDE_DIR - where to find lua.h
# OpenThreads_LIBRARIES - List of fully qualified libraries to link against
# OpenThreads_FOUND - Set to TRUE if found

# Copyright (c) 2007, Pau Garcia i Quiles, <[EMAIL PROTECTED]>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

SET( OPENTHREADS_TEST_SOURCE "
	\#include <OpenThreads/Thread>

	class DummyThread : public OpenThreads::Thread { 
		public: 
			DummyThread() \;
			~DummyThread() \;
			int cancel() \;
			void run() \;
			void cancelCleanup() \;
	} \;
	
	DummyThread::DummyThread() { }

	DummyThread::~DummyThread() { }

	int DummyThread::cancel() { }

	void DummyThread::run() { }

	void DummyThread::cancelCleanup() {}

	int main(int argc, char * argv[]) { 
		DummyThread::DummyThread() \;
		return 0 \; 
	}"
)

IF(OpenThreads_INCLUDE_DIR AND OpenThreads_LIBRARIES)
    SET(OpenThreads_FIND_QUIETLY TRUE)
ENDIF(OpenThreads_INCLUDE_DIR AND OpenThreads_LIBRARIES)

FIND_PATH(OpenThreads_INCLUDE_DIR OpenThreads/Thread )

FIND_LIBRARY(OpenThreads_LIBRARIES NAMES OpenThreads )

SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} OpenThreads)
IF(OpenThreads_INCLUDE_DIR AND OpenThreads_LIBRARIES)
   SET(OpenThreads_FOUND TRUE)
   INCLUDE(CheckCXXSourceCompiles)
   CHECK_CXX_SOURCE_COMPILES( ${OPENTHREADS_TEST_SOURCE} OpenThreads_COMPILES_FINE )
   IF(OpenThreads_COMPILES_FINE)
     MESSAGE(STATUS "OpenThreads programs should compile fine")
   ELSE(OpenThreads_COMPILES_FINE)
     MESSAGE(STATUS "OpenThreads headers and libraries are present but it seems programs cannot be compiled")
   ENDIF(OpenThreads_COMPILES_FINE)

ELSE(OpenThreads_INCLUDE_DIR AND OpenThreads_LIBRARIES)
   SET(OpenThreads_FOUND FALSE)
ENDIF (OpenThreads_INCLUDE_DIR AND OpenThreads_LIBRARIES)

IF(OpenThreads_FOUND)
  IF (NOT OpenThreads_FIND_QUIETLY)
    MESSAGE(STATUS "Found OpenThreads library: ${OpenThreads_LIBRARIES}")
    MESSAGE(STATUS "Found OpenThreads headers: ${OpenThreads_INCLUDE_DIR}")
  ENDIF (NOT OpenThreads_FIND_QUIETLY)
ELSE(OpenThreads_FOUND)

  IF(OpenThreads_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could NOT find OpenThreads")
  ENDIF(OpenThreads_FIND_REQUIRED)
ENDIF(OpenThreads_FOUND)

MARK_AS_ADVANCED(OpenThreads_INCLUDE_DIR OpenThreads_LIBRARIES)
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to