File: CheckFunctions.cmake

package info (click to toggle)
lizardfs 3.10.4%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,072 kB
  • ctags: 9,596
  • sloc: cpp: 83,275; sh: 8,951; python: 3,872; ansic: 332; pascal: 128; makefile: 60
file content (22 lines) | stat: -rw-r--r-- 609 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function(check_functions FUNCTIONS REQUIRED)
  foreach(FUNC ${FUNCTIONS})
    string(TOUPPER "LIZARDFS_HAVE_${FUNC}" VAR)
    CHECK_FUNCTION_EXISTS(${FUNC} ${VAR})
    if(${REQUIRED})
      if("${${VAR}}" STREQUAL "" OR NOT ${${VAR}} EQUAL 1)
        message(SEND_ERROR "function ${FUNC} is required")
      endif()
    endif()
  endforeach()
endfunction()

function(check_template_function_exists HEADER CALL OUTPUT_VARIABLE)
	if (NOT DEFINED ${OUTPUT_VARIABLE})
		check_cxx_source_compiles("
#include <${HEADER}>
	int main(int, char**) {
		${CALL};
		return 0;
}" ${OUTPUT_VARIABLE})
	endif()
endfunction()