-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFindPdm.cmake
49 lines (44 loc) · 1.12 KB
/
FindPdm.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
45
46
47
48
49
find_program(Pdm_EXECUTABLE pdm HINTS "${Pdm_DIR}")
if(Pdm_EXECUTABLE)
if(NOT TARGET Pdm::Pdm)
add_executable(Pdm::Pdm IMPORTED)
set_target_properties(Pdm::Pdm
PROPERTIES
IMPORTED_LOCATION "${Pdm_EXECUTABLE}"
)
endif()
if(WIN32)
execute_process(
COMMAND cmd /C "${Pdm_EXECUTABLE}" --version
RESULT_VARIABLE result
OUTPUT_VARIABLE version
)
else()
execute_process(
COMMAND "${Pdm_EXECUTABLE}" --version
RESULT_VARIABLE result
OUTPUT_VARIABLE version
)
endif()
if("${result}" EQUAL 0)
if("${version}" MATCHES "PDM, version (.*)")
string(STRIP "${CMAKE_MATCH_1}" Pdm_VERSION)
endif()
endif()
include(River)
river_wrap_command(
NAME pdm_install
COMMAND "${Pdm_EXECUTABLE}" install
OPTIONS
VERBOSE QUIET GLOBAL DRY_RUN NO_LOCK CHECK PLUGINS NO_DEFAULT DEV PRODUCTION
NO_EDITABLE NO_SELF FAIL_FAST NO_ISOLATION
SINGLES
PROJECT LOCK_FILE SKIP GROUP
)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Pdm
REQUIRED_VARS Pdm_EXECUTABLE
VERSION_VAR Pdm_VERSION
)