Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/freealut-1.1.0/admin/CMakeModules/FindCompilerVisibility.cmake @ 14

Last change on this file since 14 was 14, checked in by landauf, 17 years ago

added freealut

File size: 1.1 KB
Line 
1SET(VAR HAVE_VISIBILITY)
2
3IF(NOT DEFINED ${VAR})
4  SET(SOURCE
5"void __attribute__((visibility(\"default\"))) test() {}
6#ifdef __INTEL_COMPILER
7#error ICC breaks with binutils and visibility
8#endif
9int main(){}
10")
11  FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/src.c" "${SOURCE}")
12
13  MESSAGE(STATUS "Performing Test ${VAR}")
14  TRY_COMPILE(${VAR}
15              ${CMAKE_BINARY_DIR}
16              ${CMAKE_BINARY_DIR}/CMakeTmp/src.c
17              CMAKE_FLAGS
18              "-DCOMPILE_DEFINITIONS:STRING=-fvisibility=hidden"
19              OUTPUT_VARIABLE OUTPUT)
20
21  WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeOutput.log
22             "Performing manual C SOURCE FILE Test ${VAR} with the following output:\n"
23             "${OUTPUT}\n"
24             "Source file was:\n${SOURCE}\n" APPEND)
25
26  SET(${VAR} ${${VAR}} CACHE INTERNAL "Test Visibility")
27  IF(${VAR})
28    MESSAGE(STATUS "Performing Test ${VAR} - Success")
29  ELSE(${VAR})
30    MESSAGE(STATUS "Performing Test ${VAR} - Failed")
31  ENDIF(${VAR})
32ENDIF(NOT DEFINED ${VAR})
33
34IF(${VAR})
35  ADD_DEFINITIONS(-fvisibility=hidden)
36  ADD_DEFINITIONS(-DHAVE_GCC_VISIBILITY)
37ENDIF(${VAR})
Note: See TracBrowser for help on using the repository browser.