aboutsummaryrefslogtreecommitdiff
path: root/test cases/linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake
blob: 4f12706ed4fa14ea357cbe2839e64edb10663daa (plain)
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_package(ZLIB)

include(CMakeFindDependencyMacro)
include(CheckCXXSourceRuns)
include(CheckCSourceRuns)

check_cxx_source_runs(
"
#include <iostream>

using namespace std;

int main(void) {
  cout << \"Hello World\" << endl;
  return 0;
}
"
CXX_CODE_RAN
)

check_c_source_runs(
"
#include <stdio.h>

int main(void) {
  printf(\"Hello World\");
  return 0;
}
"
C_CODE_RAN
)

if(NOT CXX_CODE_RAN)
  message(FATAL_ERROR "Running CXX source code failed")
endif()

if(NOT C_CODE_RAN)
  message(FATAL_ERROR "Running C source code failed")
endif()

find_dependency(Threads)

if(ZLIB_FOUND OR ZLIB_Found)
  set(SomethingLikeZLIB_FOUND        ON)
  set(SomethingLikeZLIB_LIBRARIES    ${ZLIB_LIBRARY})
  set(SomethingLikeZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
else()
  set(SomethingLikeZLIB_FOUND       OFF)
endif()