File: CheckCPPDirective.cmake

package info (click to toggle)
insighttoolkit5 5.4.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 704,384 kB
  • sloc: cpp: 783,592; ansic: 628,724; xml: 44,704; fortran: 34,250; python: 22,874; sh: 4,078; pascal: 2,636; lisp: 2,158; makefile: 464; yacc: 328; asm: 205; perl: 203; lex: 146; tcl: 132; javascript: 98; csh: 81
file content (34 lines) | stat: -rw-r--r-- 1,588 bytes parent folder | download
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
#
# Checks whether this platform has a given preprocessor directive
#
# VARIABLE - variable to store the result to
#

get_filename_component(_CheckCPPDirective_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

macro(CHECK_CPP_DIRECTIVE_EXISTS DIRECTIVE VARIABLE)
  if(NOT DEFINED "HAVE_${VARIABLE}")
    message(STATUS "Checking to see if this platform has the ${DIRECTIVE} C-Preprocessor directive")
    set(DIRECTIVE ${DIRECTIVE})
    configure_file(${_CheckCPPDirective_DIR}/CheckCPPDirectiveExists.cxx.in
                   ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPPDirectiveExists.cxx)
    try_compile(
      ${VARIABLE} ${CMAKE_BINARY_DIR}
      ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPPDirectiveExists.cxx
      OUTPUT_VARIABLE OUTPUT)
    if(${VARIABLE})
      set(HAVE_${VARIABLE}
          TRUE
          CACHE INTERNAL " ")
      message(STATUS "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive - yes")
      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
           "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive with "
           "the following output:\n${OUTPUT}\n\n")
    else()
      message(STATUS "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive - no")
      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
           "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive with "
           "the following output:\n${OUTPUT}\n\n")
    endif()
  endif()
endmacro()