Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

CheckPrototypeExists.cmake 1.2 KB

You have to be logged in to leave a comment. Sign In
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
  1. #
  2. # $Id$
  3. #
  4. # - Check if the prototype for a function exists.
  5. # CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE)
  6. #
  7. # FUNCTION - the name of the function you are looking for
  8. # HEADER - the header(s) where the prototype should be declared
  9. # VARIABLE - variable to store the result
  10. #
  11. # The following variables may be set before calling this macro to
  12. # modify the way the check is run:
  13. #
  14. # CMAKE_REQUIRED_FLAGS = string of compile command line flags
  15. # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
  16. # CMAKE_REQUIRED_INCLUDES = list of include directories
  17. # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
  18. #
  19. # Redistribution and use is allowed according to the terms of the BSD license.
  20. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  21. INCLUDE(CheckCSourceCompiles)
  22. MACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
  23. SET(_INCLUDE_FILES)
  24. FOREACH (it ${_HEADER})
  25. SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
  26. ENDFOREACH (it)
  27. SET(_CHECK_PROTO_EXISTS_SOURCE_CODE "
  28. ${_INCLUDE_FILES}
  29. int main()
  30. {
  31. #ifndef ${_SYMBOL}
  32. int i = sizeof(&${_SYMBOL});
  33. #endif
  34. return 0;
  35. }
  36. ")
  37. CHECK_C_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT})
  38. ENDMACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...