-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathImportSparrow.cmake
44 lines (43 loc) · 1.48 KB
/
ImportSparrow.cmake
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
#
# This file is licensed under the 3-clause BSD license.
# Copyright Department of Chemistry and Applied Biosciences, Reiher Group.
# See LICENSE.txt for details.
#
macro(import_sparrow)
# If the target already exists, do nothing
if(TARGET Scine::Sparrow)
message(STATUS "Scine::Sparrow present.")
else()
# Try to find the package locally
find_package(ScineSparrow QUIET)
if(TARGET Scine::Sparrow)
message(STATUS "Scine::Sparrow found locally at ${ScineSparrow_DIR}")
else()
# Download it instead
include(DownloadProject)
download_project(
PROJ scine-sparrow
GIT_REPOSITORY https://github.com/qcscine/sparrow.git
GIT_TAG 5.1.0
QUIET
)
# Note: Options defined in the project calling this function override default
# option values specified in the imported project.
add_subdirectory(${scine-sparrow_SOURCE_DIR} ${scine-sparrow_BINARY_DIR})
# Final check if all went well
if(TARGET Scine::Sparrow)
message(STATUS
"Scine::Sparrow was not found in your PATH, so it was downloaded."
)
else()
string(CONCAT error_msg
"Scine::Sparrow was not found in your PATH and could not be downloaded. "
"Try specifying Scine_DIR or altering "
"CMAKE_PREFIX_PATH to point to a candidate Scine installation base "
"directory."
)
message(FATAL_ERROR ${error_msg})
endif()
endif()
endif()
endmacro()