File: openssl_v_err.cmake

package info (click to toggle)
xca 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,328 kB
  • sloc: cpp: 30,584; sh: 341; xml: 74; makefile: 56; python: 34
file content (15 lines) | stat: -rw-r--r-- 726 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# CMake function to find the headerfile x509_vfy.h and search for all occurrences
# of X509_V_ERR_ and replace them by #ifdef x V_ERR(x) #endif

if (OPENSSL_INCLUDE_DIR)
    set(OPENSSL_V_ERR_H "${OPENSSL_INCLUDE_DIR}/openssl/x509_vfy.h")
    if (EXISTS "${OPENSSL_V_ERR_H}")
        message(STATUS "Parsing ${OPENSSL_V_ERR_H} for X509_V_ERR_")
        file(READ "${OPENSSL_V_ERR_H}" X509_VFY_H)
        string(REGEX MATCHALL "X509_V_ERR_[A-Z_0-9]+" X509_VFY_ERRORS ${X509_VFY_H})
        foreach(ERR ${X509_VFY_ERRORS})
            string(APPEND X509_VFY_ERRORS_C "#ifdef ${ERR}\n V_ERR(${ERR})\n#endif\n")
        endforeach()
        file(WRITE ${CMAKE_BINARY_DIR}/openssl_v_err.c ${X509_VFY_ERRORS_C})
    endif()
endif()