Skip to content

Commit

Permalink
update #1
Browse files Browse the repository at this point in the history
try fix CI (detection of Eigen3)
  • Loading branch information
prudhomm committed Jul 8, 2023
1 parent 23de6ba commit f5a999a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.9)
project(EigenRand VERSION 0.5.0 DESCRIPTION "EigenRand, Random Number Generator for Eigen")

include(GNUInstallDirs)
include(FetchContent)

option(EIGENRAND_BUILD_TEST "Build Test sets" ON)

Expand All @@ -29,11 +30,21 @@ set ( ADDITIONAL_FLAGS "${EIGENRAND_CXX_FLAGS}" )
if ( NOT TARGET Eigen3::Eigen )
message(STATUS "Eigen3 not available from master project")
if ( EXISTS ${PROJECT_SOURCE_DIR}/include/Eigen )
# Set the path to the directory containing Eigen3
list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/include/Eigen")
message(STATUS "Eigen3 directory found locally in ${PROJECT_SOURCE_DIR}/include/Eigen")
# this is for the CI
include_directories(${PROJECT_SOURCE_DIR}/include)
add_library(Eigen INTERFACE)
add_library(Eigen3::Eigen ALIAS Eigen)
target_include_directories(Eigen INTERFACE ${PROJECT_SOURCE_DIR}/include)
else()
find_package(Eigen3)
# try harder to find Eigen3 using pkgconfig
if (NOT TARGET Eigen3::Eigen )
message(STATUS "Eigen3 not found with find_package(Eigen3), trying to find using pkgconfig")
find_package(PkgConfig REQUIRED)
pkg_search_module(Eigen3 REQUIRED eigen3)
endif()
endif()
find_package(Eigen3 REQUIRED)

# Check if Eigen3 is found
if(TARGET Eigen3::Eigen )
message(STATUS "Eigen3 found")
Expand Down Expand Up @@ -101,7 +112,7 @@ foreach(app ${ITEMS})
install(TARGETS ${project_name_lower}-${app_name_lower} DESTINATION bin)
endforeach()

include(FetchContent)

set(FETCHCONTENT_SOURCE_DIR_GOOGLETEST ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
message(STATUS "FETCHCONTENT_SOURCE_DIR_GOOGLETEST: ${FETCHCONTENT_SOURCE_DIR_GOOGLETEST}")
FetchContent_Declare(googletest GIT_REPOSITORY https://github.com/google/googletest GIT_TAG v1.8.x)
Expand Down

0 comments on commit f5a999a

Please sign in to comment.