-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
113 lines (96 loc) · 2.71 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
cmake_minimum_required(VERSION 3.16)
project(gmsh2exo
VERSION 0.8
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(FetchContent)
include(${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake)
option(GMSH2EXO_BUILD_TESTS "Build tests" NO)
find_package(fmt 9.1 REQUIRED)
FetchContent_Declare(
exodusIIcpp
GIT_REPOSITORY https://github.com/andrsd/exodusIIcpp.git
GIT_TAG v2.0.2
)
mark_as_advanced(FORCE
FETCHCONTENT_SOURCE_DIR_EXODUSIICPP
FETCHCONTENT_UPDATES_DISCONNECTED_EXODUSIICPP
EXODUSIICPP_BUILD_TESTS
)
FetchContent_Declare(
gmshparsercpp
GIT_REPOSITORY https://github.com/andrsd/gmshparsercpp.git
GIT_TAG 8e946a98fb05e6e1b23a21454d014c86c4e6d694
)
mark_as_advanced(FORCE
FETCHCONTENT_SOURCE_DIR_GMSHPARSERCPP
FETCHCONTENT_UPDATES_DISCONNECTED_GMSHPARSERCPP
GMSHPARSERCPP_BUILD_TESTS
)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
mark_as_advanced(FORCE
BUILD_GMOCK
INSTALL_GTEST
FETCHCONTENT_SOURCE_DIR_GOOGLETEST
FETCHCONTENT_UPDATES_DISCONNECTED_GOOGLETEST
)
if(EXODUSIICPP_LIBRARY_TYPE STREQUAL "STATIC")
FetchContent_GetProperties(exodusIIcpp)
if(NOT exodusIIcpp_POPULATED)
FetchContent_Populate(exodusIIcpp)
add_subdirectory(${exodusiicpp_SOURCE_DIR} ${exodusiicpp_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
else()
FetchContent_MakeAvailable(exodusIIcpp)
endif()
if(GMSHPARSERCPP_LIBRARY_TYPE STREQUAL "STATIC")
FetchContent_GetProperties(gmshparsercpp)
if(NOT gmshparsercpp_POPULATED)
FetchContent_Populate(gmshparsercpp)
add_subdirectory(${gmshparsercpp_SOURCE_DIR} ${gmshparsercpp_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
else()
FetchContent_MakeAvailable(gmshparsercpp)
endif()
if (GMSH2EXO_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
mark_as_advanced(FORCE
FETCHCONTENT_BASE_DIR
FETCHCONTENT_FULLY_DISCONNECTED
FETCHCONTENT_QUIET
FETCHCONTENT_UPDATES_DISCONNECTED
)
#
file(GLOB SRCS CONFIGURE_DEPENDS src/*.cpp)
add_executable(${PROJECT_NAME} ${SRCS})
target_code_coverage(${PROJECT_NAME})
target_compile_definitions(${PROJECT_NAME}
PRIVATE
-DGMSH2EXO_VERSION="${CMAKE_PROJECT_VERSION}"
)
target_include_directories(${PROJECT_NAME}
PRIVATE
${PROJECT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/contrib/cxxopts
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
fmt::fmt
exodusIIcpp
gmshparsercpp
)
install(
TARGETS gmsh2exo
RUNTIME DESTINATION bin
)