-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
53 lines (42 loc) · 1.98 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#This file shows how to link to a PUMI
#installation using CMake
#it represents a simple 'CMakeLists.txt'
#file for a new project
cmake_minimum_required(VERSION 3.0.0)
project(a1 VERSION 1.0.0 LANGUAGES CXX)
# include the eigen libraries
#/home/osama/Desktop/eigen-eigen-323c052e1731/Eigen
SET( EIGEN3_INCLUDE_DIR "/home/osama/Desktop/eigen-eigen-323c052e1731/Eigen" )
IF( NOT EIGEN3_INCLUDE_DIR )
MESSAGE( FATAL_ERROR "Please point the environment variable EIGEN3_INCLUDE_DIR to the include directory of your Eigen3 installation.")
ENDIF()
INCLUDE_DIRECTORIES ( "${EIGEN3_INCLUDE_DIR}" )
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
# Starting here are the critical lines:
# Allow the user to indicate where they installed SCOREC
# via "-DSCOREC_PREFIX=/home/somewhere" when calling `cmake`
set(SCOREC_PREFIX "" CACHE STRING "Directory where SCOREC is installed")
# If SCOREC_PREFIX was specified, only link to that directory,
# i.e. don't link to another installation in /usr/lib by mistake
if (SCOREC_PREFIX)
find_package(SCOREC 2.1.0 REQUIRED CONFIG PATHS ${SCOREC_PREFIX} NO_DEFAULT_PATH)
else()
# IF SCOREC_PREFIX was not specified, look in typical system directories,
# and also in CMAKE_PREFIX_PATH (environment variable)
find_package(
SCOREC #package name, has to be SCOREC
2.1.0 #version. can be omitted, and will match any installed version
#greater than or equal to this one, as long as the major number
#is the same
REQUIRED #indicate that SCOREC is really needed to compile
CONFIG #skip the 'MODULE' search system, save some time and confusion
)
endif()
#this is just example code, do your own thing
add_executable(main main.cc)
#for any targets that use PUMI, just use this command
#to it to include the right directories and link to all
#the scorec libraries automatically.
#we recommend PUBLIC if the target is a library and
#PRIVATE if the target is an executable
target_link_libraries(main PRIVATE SCOREC::core Eigen3::Eigen)