-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (62 loc) · 1.95 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
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(PCMSolver LANGUAGES CXX Fortran)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Use BUILD_SHARED_LIBS to toggle between static and shared
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/subprojects)
set(STAGED_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/stage)
message(STATUS "PCMSolver staging: ${STAGED_INSTALL_PREFIX}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/upstream)
include(ExternalProject)
ExternalProject_Add(pcmsolver-core
DEPENDS
Eigen3_external
taylor_external
SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/src
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_CXX_EXTENSIONS=OFF
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
-DEigen3_DIR=${Eigen3_DIR}
-Dtaylor_DIR=${taylor_DIR}
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
#-DBUILD_SHARED_LIBS=ON
BUILD_ALWAYS
1
)
# this one mimicks using DESTDIR
install(
DIRECTORY
${STAGED_INSTALL_PREFIX}/
DESTINATION
.
USE_SOURCE_PERMISSIONS
)
# Use the BUILD_TESTING standard option to control testing
# It is ON by default
include(CTest)
if(BUILD_TESTING)
ExternalProject_Add(test-PCMSolver
DEPENDS
pcmsolver-core
SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/tests
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_CXX_EXTENSIONS=OFF
-DPARENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DEigen3_DIR=${Eigen3_DIR}
-DPCMSolver_DIR=${STAGED_INSTALL_PREFIX}/share/cmake/PCMSolver
)
endif()