-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
79 lines (64 loc) · 1.84 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
cmake_minimum_required(VERSION 3.13)
# configure.ac: AC_INIT([cfd], [1.0]
set(PACKAGE_VERSION 1.0.0)
####################
# options
####################
include(./cmake/CfdCommonOption.cmake)
include(./cmake/CfdWallyOption.cmake)
option(CFD_SHARED "force shared build (ON or OFF. default:OFF)" OFF)
option(ENABLE_CAPI "enable c-api (ON or OFF. default:ON)" ON)
option(ENABLE_JSONAPI "enable json-api (ON or OFF. default:ON)" ON)
set(GENERATE_WALLY ON CACHE BOOL "" FORCE)
set(EXCLUDE_WALLYCORE_LIB ON CACHE BOOL "" FORCE)
####################
# common setting
####################
include(./cmake/CfdCommonSetting.cmake)
####################
# test
####################
project(cfd_all_test CXX)
if(ENABLE_TESTS)
enable_testing()
endif() # ENABLE_TESTS
####################
# subdirectories
####################
if(NOT CFD_SINGLE_BUILD)
add_subdirectory(external)
endif()
add_subdirectory(src)
####################
# test subdirectories
####################
if(ENABLE_TESTS)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(CTest)
add_subdirectory(test)
endif() # ENABLE_TESTS
####################
# install & export
####################
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${prefix})
set(libdir ${exec_prefix}/lib)
set(includedir ${prefix}/include)
include(GNUInstallDirs)
configure_file(pc/cfd.pc.in cfd.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cfd.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
####################
# uninstall
####################
if(NOT TARGET uninstall)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/pc/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()