-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
34 lines (28 loc) · 915 Bytes
/
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
cmake_minimum_required(VERSION "3.14")
project (FORTRAN_YAML_C VERSION "0.2.6" LANGUAGES C Fortran)
include(FortranCInterface)
FortranCInterface_VERIFY()
set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/modules")
option(DOWNLOAD_LIBYAML "If ON, then libyaml will be downloaded and
built." ON)
# Find libyaml
if (DOWNLOAD_LIBYAML)
# use CPM to download and build libyaml
include(cmake/CPM.cmake)
CPMAddPackage(
NAME libyaml
VERSION 0.2.5
GITHUB_REPOSITORY "yaml/libyaml"
GIT_TAG "release/0.2.5"
EXCLUDE_FROM_ALL ON
)
else()
# Try to find libyaml using pkg-config
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML REQUIRED IMPORTED_TARGET yaml-0.1)
if (NOT (${YAML_VERSION} STREQUAL "0.2.5"))
message(FATAL_ERROR "PkgConfig found yaml version ${YAML_VERSION} but version 0.2.5 is required")
endif()
endif()
add_subdirectory(src)
add_subdirectory(tests)