-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathCPPANConfig.cmake
More file actions
48 lines (35 loc) · 1.42 KB
/
CPPANConfig.cmake
File metadata and controls
48 lines (35 loc) · 1.42 KB
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
################################################################################
find_program(CPPAN_EXECUTABLE cppan)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CPPAN DEFAULT_MSG CPPAN_EXECUTABLE)
mark_as_advanced(CPPAN_EXECUTABLE)
########################################
set(CPPAN_DEPS_DIR ${CMAKE_BINARY_DIR}/.cppan/cmake CACHE STRING "Cppan local deps dir.")
set(CPPAN_DEPS_FILE ${CPPAN_DEPS_DIR}/cppan.yml CACHE STRING "Cppan local deps file.")
file(WRITE ${CPPAN_DEPS_FILE} "dependencies:\n")
########################################
# FUNCTION cppan_add_dependency
########################################
function(cppan_add_package)
foreach(a ${ARGN})
file(APPEND ${CPPAN_DEPS_FILE} " - ${a}\n")
endforeach()
endfunction()
########################################
# FUNCTION cppan_execute
########################################
function(cppan_execute)
message(STATUS "cppan: processing dependencies")
if (CPPAN_FORCE)
set(CPPAN_FORCE -s)
endif()
execute_process(
COMMAND ${CPPAN_EXECUTABLE} -d "${CPPAN_DEPS_DIR}" ${CPPAN_FORCE}
RESULT_VARIABLE ret
)
if (NOT ${ret} EQUAL 0)
message(FATAL_ERROR "cppan: non-zero exit code - ${ret}")
endif()
add_subdirectory(${CPPAN_DEPS_DIR}/.cppan ${CPPAN_DEPS_DIR}/.cppan/cmake_bdir)
endfunction()
################################################################################