From 60e6b3897c69a5bdc9ad808f4cfd691628ac8ab3 Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Thu, 4 Dec 2008 15:31:23 +0100 Subject: [PATCH] Check pointer size at build time to detect 64bit platform and locate automatically the presence of pthread library. --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9247574..c6abbce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmessage-length=0 -Wdisabled-optimization") SET(CMAKE_BUILD_TYPE "Release") +INCLUDE(CheckTypeSize) + INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/AstroToolbox") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/Functions/rng") @@ -14,6 +16,14 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/basic") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/GOclasses/problems") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/SolversThreads") +CHECK_TYPE_SIZE("void *" POINTER_SIZE) +MESSAGE(STATUS "Pointer size = ${POINTER_SIZE}") + +FIND_LIBRARY(PTHREAD_LIBRARY pthread) +IF(NOT PTHREAD_LIBRARY) + MESSAGE(FATAL_ERROR "pthread library not found, please specify manually where it is located.") +ENDIF(NOT PTHREAD_LIBRARY) + SET(PAGMO_LIB_SRC_LIST ${CMAKE_SOURCE_DIR}/AstroToolbox/Astro_Functions.cpp ${CMAKE_SOURCE_DIR}/AstroToolbox/Lambert.cpp @@ -43,5 +53,5 @@ ADD_LIBRARY(pagmo STATIC ${PAGMO_LIB_SRC_LIST}) ADD_EXECUTABLE(main main.cpp) -TARGET_LINK_LIBRARIES(main pagmo pthread) +TARGET_LINK_LIBRARIES(main pagmo ${PTHREAD_LIBRARY}) -- 2.11.4.GIT