aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-04-19 11:19:22 -0400
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-04-19 11:19:22 -0400
commit84d1b2ae3a7187f418b1cbbec03eabda372ea699 (patch)
tree2a62b619ec3e5299edfcf3b7e4a184670ff3e29a /CMakeLists.txt
parent40b2aaa8b149403a8f345f1f7721ddd6088db669 (diff)
add platform check for how to link to the standard math library.
This allows to support QNX.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 37 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5f10ab81..5418a06ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,10 +2,17 @@ project(Eigen)
cmake_minimum_required(VERSION 2.6.2)
+
+# guard against in-source builds
+
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. (you may need to remove CMakeCache.txt ")
endif()
+#############################################################################
+# retrieve version infomation #
+#############################################################################
+
# automatically parse the version number
file(READ "${CMAKE_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}")
@@ -33,10 +40,40 @@ else(EIGEN_HG_CHANGESET)
set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}")
endif(EIGEN_HG_CHANGESET)
+
include(CheckCXXCompilerFlag)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+#############################################################################
+# find how to link to the standard libraries #
+#############################################################################
+
+find_package(StandardMathLibrary)
+
+set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "")
+
+if(NOT STANDARD_MATH_LIBRARY_FOUND)
+
+ message(FATAL_ERROR
+ "Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.")
+
+else()
+
+ if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
+ set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}")
+ else()
+ set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}")
+ endif()
+
+endif()
+
+if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
+ message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}")
+else()
+ message(STATUS "Standard libraries to link to explicitly: none")
+endif()
+
option(EIGEN_BUILD_BTL "Build benchmark suite" OFF)
if(NOT WIN32)
option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON)