TestNO_ICC_IDYNAMIC_NEEDED.cmake 1.7 KB
Newer Older
1
# Tests whether the compiler is Intel icc and needs -i_dynamic
2 3

MACRO(TESTNO_ICC_IDYNAMIC_NEEDED VARIABLE LOCAL_TEST_DIR)
4
  IF(NOT DEFINED "HAVE_${VARIABLE}")
5 6 7 8 9 10 11
    TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
      ${CMAKE_BINARY_DIR}
      ${LOCAL_TEST_DIR}/TestNO_ICC_IDYNAMIC_NEEDED.cxx
      OUTPUT_VARIABLE OUTPUT)
    MESSAGE(STATUS "Check if using the Intel icc compiler, and if -i_dynamic is needed... COMPILE_RESULT...${HAVE_${VARIABLE}} RUN_RESULT...${VARIABLE}\n")
    IF(HAVE_${VARIABLE}) #Test compiled, either working intel w/o -i_dynamic, or another compiler
      IF(${VARIABLE})   #Intel icc compiler, -i_dynamic not needed
Ken Martin's avatar
Ken Martin committed
12
        FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
13 14
                       "-i_dynamic not needed, (Not Intel icc, or this version of Intel icc does not conflict with OS glibc.")
        MESSAGE(STATUS "-i_dynamic not needed, (Not Intel icc, or this version of Intel icc does not conflict with OS glibc.")
15
      ELSE() #The compiler is not Intel icc
16
        FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
17 18
                       "The compiler ERROR--This should never happen")
        MESSAGE(STATUS "The compiler ERROR--This should never happen")
19 20
      ENDIF()
    ELSE()  #Test did not compile, either badly broken compiler, or intel -i_dynamic needed
Ken Martin's avatar
Ken Martin committed
21
      FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
22 23
            "\tThe -i_dynamic compiler flag is needed for the Intel icc compiler on this platform.\n")
      MESSAGE("The -i_dynamic compiler flag is needed for the Intel icc compiler on this platform.")
24
    ENDIF()
Ken Martin's avatar
Ken Martin committed
25
    FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "TestNO_ICC_IDYNAMIC_NEEDED produced following output:\n${OUTPUT}\n\n")
26
  ENDIF()
27
ENDMACRO()