Debian Codegraph @

vendored-meson/meson/test cases/linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake

raw
1 find_package(ZLIB)
2
3 include(CMakeFindDependencyMacro)
4 include(CheckCXXSourceRuns)
5 include(CheckCSourceRuns)
6
7 # Do something stupid (see https://github.com/mesonbuild/meson/issues/7501)
8 set("")
9
10 check_cxx_source_runs(
11 "
12 #include <iostream>
13
14 using namespace std;
15
16 int main(void) {
17 cout << \"Hello World\" << endl;
18 return 0;
19 }
20 "
21 CXX_CODE_RAN
22 )
23
24 check_c_source_runs(
25 "
26 #include <stdio.h>
27
28 int main(void) {
29 printf(\"Hello World\");
30 return 0;
31 }
32 "
33 C_CODE_RAN
34 )
35
36 if(NOT CXX_CODE_RAN)
37 message(FATAL_ERROR "Running CXX source code failed")
38 endif()
39
40 if(NOT C_CODE_RAN)
41 message(FATAL_ERROR "Running C source code failed")
42 endif()
43
44 if(NOT SomethingLikeZLIB_FIND_COMPONENTS STREQUAL "required_comp")
45 message(FATAL_ERROR "Component 'required_comp' was not specified")
46 endif()
47
48 find_dependency(Threads)
49
50 if(ZLIB_FOUND OR ZLIB_Found)
51 set(SomethingLikeZLIB_FOUND ON)
52 set(SomethingLikeZLIB_LIBRARIES ${ZLIB_LIBRARY})
53 set(SomethingLikeZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
54 else()
55 set(SomethingLikeZLIB_FOUND OFF)
56 endif()