Line | |
---|
1 | SET(VAR HAVE_VISIBILITY) |
---|
2 | |
---|
3 | IF(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 |
---|
9 | int 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}) |
---|
32 | ENDIF(NOT DEFINED ${VAR}) |
---|
33 | |
---|
34 | IF(${VAR}) |
---|
35 | ADD_DEFINITIONS(-fvisibility=hidden) |
---|
36 | ADD_DEFINITIONS(-DHAVE_GCC_VISIBILITY) |
---|
37 | ENDIF(${VAR}) |
---|
Note: See
TracBrowser
for help on using the repository browser.