-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCMakeLists.txt
59 lines (46 loc) · 1.76 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
54
55
56
57
58
59
#
# Example CMake file for John Urbanic's laplace
# solver, now using a C++ compiler.
#
# Make sure we don't have a pre-historic CMake version
cmake_minimum_required(VERSION 3.0)
# Enable policy 0048 to allow setting version with the project command
set(CMP0048 NEW)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
project(Laplace VERSION 0.1)
set(PROJECT_VERSION_STRING "${PROJECT_VERSION}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose type of build, options are: Debug, MinSizeRel, Release, RelWithDebInfo" FORCE)
option(BUILD_TESTS "Enable unit test building" ON)
option(OPENMP "Enable OpenMP compiler support" OFF)
option(OPENACC "Enable OpenACC compiler support" OFF)
# Use GNUInstallDirs to set paths on multiarch systems.
include(GNUInstallDirs)
# Add the OpenMP compiler flags before other tests, since this might change the
# behavior on some platforms
if(OPENMP)
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(HAVE_OPENMP TRUE)
else()
message(ERROR "OpenMP support requested, but no compiler support found.")
endif()
endif()
# Enable OpenACC support
if(OPENACC)
find_package(OpenACC)
if(OPENACC_CXX_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenACC_CXX_FLAGS}")
set(HAVE_OPENACC TRUE)
set(OPENACC_VERSION OpenACC_CXX_VERSION)
else()
message(ERROR "OpenACC support requested, but no compiler support found.")
endif()
endif()
# Test and add some extra compiler flags
include(CompilerFlags)
add_subdirectory(src)
add_subdirectory(docs)