vtkTestBuiltins.cmake 1.11 KB
Newer Older
1 2
# check for gcc/clang atomic builtins like __sync_add_and_fetch
IF(NOT WIN32)
3
  IF(NOT DEFINED VTK_HAVE_SYNC_BUILTINS)
4 5 6 7 8 9 10 11
  MESSAGE(STATUS "Checking for builtin __sync_add_and_fetch")
  TRY_COMPILE(VTK_TEST_SYNC_BUILTINS_COMPILED
    ${VTK_BINARY_DIR}/CMakeTmp/Sync
    ${VTK_CMAKE_DIR}/vtkTestSyncBuiltins.cxx
    OUTPUT_VARIABLE OUTPUT)
  IF(VTK_TEST_SYNC_BUILTINS_COMPILED)
    MESSAGE(STATUS "Checking for builtin __sync_add_and_fetch -- success")
    SET(VTK_HAVE_SYNC_BUILTINS 1 CACHE INTERNAL "For __sync atomic builtins.")
12
    FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
13 14
      "Determining if the C++ compiler supports __sync_add_and_fetch builtin "
      "passed with the following output:\n"
15
      "${OUTPUT}\n")
16
  ELSE()
17 18
    MESSAGE(STATUS "Checking for builtin __sync_add_and_fetch -- failed")
    SET(VTK_HAVE_SYNC_BUILTINS 0 CACHE INTERNAL "For __sync atomic builtins.")
19
    FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
20 21
      "Determining if the C++ compiler supports __sync_add_and_fetch builtin "
      "failed with the following output:\n"
22
      "${OUTPUT}\n")
23
  ENDIF()
24 25
  ENDIF()
ENDIF()