-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
119 lines (101 loc) · 3.49 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
114
115
116
117
118
cmake_minimum_required(VERSION 3.5)
project("xmgr" LANGUAGES C)
cmake_policy(SET CMP0115 OLD)
cmake_policy(SET CMP0075 OLD)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo
CACHE STRING "Build type: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
set(CMAKE_C_STANDARD 99)
set(CMAKE_MODULE_PATH cmake)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# Interface library for all targets
add_library(project_warnings INTERFACE)
include(cmake/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
find_package(Motif REQUIRED)
find_package(X11 REQUIRED)
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
# On ubuntu 22.04, rpc/rpc.h is provided by libtirpc
if (NOT EXISTS "/usr/include/rpc/rpc.h")
find_package(TIRPC MODULE REQUIRED)
include_directories(${TIRPC_INCLUDE_DIRS})
link_libraries(${TIRPC_LIBRARIES})
endif()
endif()
include(CheckIncludeFiles)
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES m)
option(ENABLE_NETCDF "Enable netcdf support" on)
if (ENABLE_NETCDF)
find_package(NETCDF)
if (NETCDF_FOUND)
set(HAVE_NETCDF 1)
set(LINKLIBS ${LINKLIBS} ${NETCDF_LIBRARY})
include_directories(SYSTEM ${NETCDF_INCLUDE_DIRS})
endif()
endif()
if (NOT X11_ICE_FOUND)
message(FATAL_ERROR "X11 ICE not found")
endif()
if (NOT X11_Xmu_FOUND)
message(FATAL_ERROR "X11 Xmu not found")
endif()
if (NOT X11_Xpm_FOUND)
message(FATAL_ERROR "X11 Xpm not found")
endif()
if (NOT X11_Xt_FOUND)
message(FATAL_ERROR "X11 Xt not found")
endif()
include_directories(${CMAKE_SOURCE_DIR})
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(alloca.h HAVE_ALLOCA_H)
check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(vfork.h HAVE_VFORK_H)
check_include_files(math.h HAVE_LIBM)
check_include_files(ieeefp.h HAVE_IEEEFP_H)
check_function_exists(drand48 HAVE_DRAND48)
check_function_exists(getcwd HAVE_GETCWD)
check_function_exists(gethostname HAVE_GETHOSTNAME)
check_function_exists(memcpy HAVE_MEMCPY)
check_function_exists(memmove HAVE_MEMMOVE)
check_function_exists(popen HAVE_POPEN)
check_function_exists(on_exit HAVE_ON_EXIT)
check_function_exists(strdup HAVE_STRDUP)
check_function_exists(strstr HAVE_STRSTR)
check_function_exists(strerror HAVE_STRERROR)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
check_function_exists(dlopen HAVE_DLOPEN)
check_function_exists(shl_load HAVE_SHL_LOAD)
check_function_exists(hypot HAVE_HYPOT)
check_function_exists(cbrt HAVE_CBRT)
check_function_exists(log2 HAVE_LOG2)
check_function_exists(rint HAVE_RINT)
check_function_exists(lgamma HAVE_LGAMMA)
check_function_exists(asinh HAVE_ASINH)
check_function_exists(acosh HAVE_ACOSH)
check_function_exists(atanh HAVE_ATANH)
check_function_exists(erf HAVE_ERF)
check_function_exists(erfc HAVE_ERFC)
check_function_exists(finite HAVE_FINITE)
check_function_exists(isfinite HAVE_ISFINITE)
check_function_exists(j0 HAVE_J0)
check_function_exists(j1 HAVE_J1)
check_function_exists(jn HAVE_JN)
check_function_exists(y0 HAVE_Y0)
check_function_exists(y1 HAVE_Y1)
check_function_exists(yn HAVE_YN)
configure_file(config.h.in config.h)
add_definitions(-DGR_HOME=\"${CMAKE_INSTALL_PREFIX}/xmgr\")
add_definitions(-DPRINT_CMD=\"lpr\")
find_program(XDGOPEN "xdg-open")
if(XDGOPEN)
add_definitions(-DGR_HELPVIEWER="${XDGOPEN} %s")
endif()
add_subdirectory(cephes)
add_subdirectory(grconvert)
add_subdirectory(src)
file(GLOB files "doc/*.html")
install(FILES ${files} DESTINATION "xmgr/doc")
install(DIRECTORY "examples" DESTINATION "xmgr")