From 673ca982f150200e27db7654ae38684b97f43b27 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Sat, 1 Feb 2020 18:02:19 +0100 Subject: cmake: Add find_package COMPONETS support --- .../linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake | 4 ++++ test cases/linuxlike/13 cmake dependency/meson.build | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'test cases/linuxlike') diff --git a/test cases/linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake b/test cases/linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake index 4f12706ed..d19f7e8c0 100644 --- a/test cases/linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake +++ b/test cases/linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake @@ -38,6 +38,10 @@ if(NOT C_CODE_RAN) message(FATAL_ERROR "Running C source code failed") endif() +if(NOT SomethingLikeZLIB_FIND_COMPONENTS STREQUAL "required_comp") + message(FATAL_ERROR "Component 'required_comp' was not specified") +endif() + find_dependency(Threads) if(ZLIB_FOUND OR ZLIB_Found) diff --git a/test cases/linuxlike/13 cmake dependency/meson.build b/test cases/linuxlike/13 cmake dependency/meson.build index a76b32789..79acc83c4 100644 --- a/test cases/linuxlike/13 cmake dependency/meson.build +++ b/test cases/linuxlike/13 cmake dependency/meson.build @@ -44,9 +44,9 @@ depPrefEnv = dependency('cmMesonTestDep', required : true, method : 'cmake') # Try to find a dependency with a custom CMake module -depm1 = dependency('SomethingLikeZLIB', required : true, method : 'cmake', cmake_module_path : 'cmake') -depm2 = dependency('SomethingLikeZLIB', required : true, method : 'cmake', cmake_module_path : ['cmake']) -depm3 = dependency('SomethingLikeZLIB', required : true, cmake_module_path : 'cmake') +depm1 = dependency('SomethingLikeZLIB', required : true, components : 'required_comp', method : 'cmake', cmake_module_path : 'cmake') +depm2 = dependency('SomethingLikeZLIB', required : true, components : 'required_comp', method : 'cmake', cmake_module_path : ['cmake']) +depm3 = dependency('SomethingLikeZLIB', required : true, components : ['required_comp'], cmake_module_path : 'cmake') # Test some edge cases with spaces, etc. -- cgit v1.2.3