Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: allow compilation on Fedora-like systems finding Eigen3 #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions eigen_typekit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,18 +2,19 @@ cmake_minimum_required(VERSION 2.8.3)
project(eigen_typekit)

find_package(Eigen3 QUIET)
if(NOT Eigen3_FOUND)
find_package(cmake_modules QUIET)
find_package(Eigen QUIET)
if(Eigen_FOUND)
set(EIGEN3_INCLUDE_DIRS ${Eigen_INCLUDE_DIRS})
set(EIGEN3_DEFINITIONS ${Eigen_DEFINITIONS})
set(EIGEN3_VERSION_STRING ${PC_EIGEN_VERSION})
else()
message(FATAL_ERROR "Could not find cmake package Eigen3 or Eigen, which is required to build ${PROEJECT_NAME}.")
endif()

if(NOT EIGEN3_FOUND)
# Fallback to cmake_modules
find_package(cmake_modules REQUIRED)
find_package(Eigen REQUIRED)
set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES}) # Not strictly necessary as Eigen is head only
# Possibly map additional variables to the EIGEN3_ prefix.
else()
set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()
message(STATUS "Found Eigen version ${EIGEN3_VERSION_STRING} at ${EIGEN3_INCLUDE_DIRS}.")
# Use ${EIGEN3_...} variables in either case below

add_definitions(${EIGEN3_DEFINITIONS})
include_directories(${EIGEN3_INCLUDE_DIRS})