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
|
include_guard()
include(CheckCSourceCompiles)
macro(check_enum_value_exists enum_value include variable)
if(NOT DEFINED ${variable})
message(STATUS "Looking for enum value ${enum_value}")
set(_CMAKE_REQUIRED_QUIET_tmp "${CMAKE_REQUIRED_QUIET}")
set(CMAKE_REQUIRED_QUIET ON)
check_c_source_compiles("
#include <${include}>
int main() {
int tmp = ${enum_value};
return 0;
}
"
${variable}
)
if(${variable})
message(STATUS "Looking for enum value ${enum_value} - found")
else()
message(STATUS "Looking for enum value ${enum_value} - not found")
endif()
set(CMAKE_REQUIRED_QUIET "${_CMAKE_REQUIRED_QUIET_tmp}")
endif()
endmacro()
|