Add checking stdatomic header file checking
authorWendy Liang <jliang@xilinx.com>
Sat, 9 Jul 2016 23:53:02 +0000 (16:53 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:45 +0000 (22:01 -0700)
Check wheter stdatomic header file exists, if not, use the
atomic operations defined in libmetal, if not, use the
atomic operations defined in libmetal.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
cmake/depends.cmake

index aee3db7159b509303ddf947858446d8f477fca4e..d8dddac9001313e5355652a76890b5e70fd6d925 100644 (file)
@@ -2,4 +2,12 @@ find_package (Libmetal REQUIRED)
 collect (PROJECT_INC_DIRS "${LIBMETAL_INCLUDE_DIR}")
 collect (PROJECT_LIB_DIRS "${LIBMETAL_LIB_DIR}")
 
+if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+  check_include_files (stdatomic.h HAVE_STDATOMIC_H)
+else ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+  set (_saved_cmake_required_flags ${CMAKE_REQUIRED_FLAGS})
+  set (CMAKE_REQUIRED_FLAGS "-c")
+  check_include_files (stdatomic.h HAVE_STDATOMIC_H)
+  set (CMAKE_REQUIRED_FLAGS ${_saved_cmake_required_flags})
+endif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
 # vim: expandtab:ts=2:sw=2:smartindent