mirror of
https://github.com/cuberite/libevent.git
synced 2025-08-04 01:36:23 -04:00
Make cmake's check_const_exists() rely on cache
(cherry picked from commit 4c61a04cd5207f2140b65f955559aa4ffc848e9c)
This commit is contained in:
parent
3f692fff32
commit
235b55215b
@ -1,23 +1,25 @@
|
|||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
macro(check_const_exists CONST FILES VARIABLE)
|
macro(check_const_exists CONST FILES VARIABLE)
|
||||||
set(check_const_exists_source "")
|
if (NOT DEFINED ${VARIABLE})
|
||||||
foreach(file ${FILES})
|
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
|
set(check_const_exists_source
|
||||||
"${check_const_exists_source}
|
"${check_const_exists_source}
|
||||||
#include <${file}>")
|
int main() { (void)${CONST}; return 0; }")
|
||||||
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})
|
check_c_source_compiles("${check_const_exists_source}" ${VARIABLE})
|
||||||
|
|
||||||
if (${${VARIABLE}})
|
if (${${VARIABLE}})
|
||||||
set(${VARIABLE} 1 CACHE INTERNAL "Have const ${CONST}")
|
set(${VARIABLE} 1 CACHE INTERNAL "Have const ${CONST}")
|
||||||
message(STATUS "Looking for ${CONST} - found")
|
message(STATUS "Looking for ${CONST} - found")
|
||||||
else()
|
else()
|
||||||
set(${VARIABLE} 0 CACHE INTERNAL "Have const ${CONST}")
|
set(${VARIABLE} 0 CACHE INTERNAL "Have const ${CONST}")
|
||||||
message(STATUS "Looking for ${CONST} - not found")
|
message(STATUS "Looking for ${CONST} - not found")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endmacro(check_const_exists)
|
endmacro(check_const_exists)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user