mirror of
https://github.com/opnsense/src.git
synced 2026-06-03 22:02:58 -04:00
Merge commit '5223d1d95fddcef6f9a36e264a5800bd907ade8b' into main (cherry picked from commit b50261e21f39a6c7249a49e7b60aa878c98512a8)
25 lines
815 B
CMake
25 lines
815 B
CMake
include(CheckCSourceCompiles)
|
|
|
|
macro(check_const_exists CONST FILES VARIABLE)
|
|
if (NOT DEFINED ${VARIABLE})
|
|
set(check_const_exists_source "")
|
|
foreach(file ${FILES})
|
|
set(check_const_exists_source
|
|
"${check_const_exists_source}
|
|
#include <${file}>")
|
|
endforeach()
|
|
set(check_const_exists_source
|
|
"${check_const_exists_source}
|
|
int main() { (void)${CONST}; return 0; }")
|
|
|
|
check_c_source_compiles("${check_const_exists_source}" ${VARIABLE})
|
|
|
|
if (${${VARIABLE}})
|
|
set(${VARIABLE} 1 CACHE INTERNAL "Have const ${CONST}")
|
|
message(STATUS "Looking for ${CONST} - found")
|
|
else()
|
|
set(${VARIABLE} 0 CACHE INTERNAL "Have const ${CONST}")
|
|
message(STATUS "Looking for ${CONST} - not found")
|
|
endif()
|
|
endif()
|
|
endmacro(check_const_exists)
|