Compare commits
5 Commits
d9eac2544c
...
43aae8243c
Author | SHA1 | Date |
---|---|---|
Nirbheek Chauhan | 43aae8243c | 5 years ago |
Daniel Mensinger | bc0f510ef1 | 5 years ago |
Michael Hirsch, Ph.D | 76b1f4f8cb | 5 years ago |
Michael Hirsch, Ph.D | b7a5d6b384 | 5 years ago |
Michael Hirsch, Ph.D | a348174313 | 5 years ago |
8 changed files with 92 additions and 22 deletions
@ -0,0 +1,24 @@ |
||||
cmake_policy(VERSION 3.7) |
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) |
||||
find_package(Python COMPONENTS Interpreter) |
||||
else() |
||||
find_package(PythonInterp) |
||||
endif() |
||||
|
||||
if(Python_FOUND OR PYTHONINTERP_FOUND) |
||||
set(SomethingLikePython_FOUND ON) |
||||
set(SomethingLikePython_EXECUTABLE ${Python_EXECUTABLE}) |
||||
|
||||
if(NOT DEFINED Python_VERSION) |
||||
set(Python_VERSION ${Python_VERSION_STRING}) |
||||
endif() |
||||
if(NOT TARGET Python::Interpreter) |
||||
add_executable(Python::Interpreter IMPORTED) |
||||
set_target_properties(Python::Interpreter PROPERTIES |
||||
IMPORTED_LOCATION ${Python_EXECUTABLE} |
||||
VERSION ${Python_VERSION}) |
||||
endif() |
||||
else() |
||||
set(SomethingLikePython_FOUND OFF) |
||||
endif() |
@ -0,0 +1,17 @@ |
||||
# We use Python3 as it's the only thing guaranteed to be available on any platform Meson can run on (unlike Zlib in linuxlike/13 cmake dependency). |
||||
|
||||
project('user CMake find_package module using cmake_module_path', |
||||
meson_version: '>= 0.50.0') |
||||
|
||||
if not find_program('cmake', required: false).found() |
||||
error('MESON_SKIP_TEST cmake binary not available.') |
||||
endif |
||||
|
||||
# NOTE: can't request Python3 via dependency('Python3', method: 'cmake') |
||||
# Meson intercepts and wants "method: auto" |
||||
|
||||
# Try to find a dependency with a custom CMake module |
||||
|
||||
dependency('SomethingLikePython', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'Python::Interpreter') |
||||
|
||||
dependency('SomethingLikePython', method : 'cmake', cmake_module_path : ['doesNotExist', 'cmake'], modules: 'Python::Interpreter') |
Loading…
Reference in new issue