Add compiler checking for visibility flag
Signed-off-by: Steven Lai <steven.lai@liricco.com>
This commit is contained in:
parent
cee2a063e9
commit
ba3c75c065
1 changed files with 7 additions and 2 deletions
|
@ -361,10 +361,15 @@ endif(UNIX)
|
|||
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
include (CheckCCompilerFlag)
|
||||
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY)
|
||||
if (HAVE_VISIBILITY)
|
||||
set(VISIBILITY_FLAG -fvisibility=hidden)
|
||||
endif()
|
||||
if (UNIX)
|
||||
set( CMAKE_C_FLAGS "-Wall -Werror -O3 -fvisibility=hidden ${CMAKE_C_FLAGS}" )
|
||||
set( CMAKE_C_FLAGS "-Wall -Werror -O3 ${VISIBILITY_FLAG} ${CMAKE_C_FLAGS}" )
|
||||
else(UNIX)
|
||||
set( CMAKE_C_FLAGS "-Wall -O3 -fvisibility=hidden ${CMAKE_C_FLAGS}" )
|
||||
set( CMAKE_C_FLAGS "-Wall -O3 ${VISIBILITY_FLAG} ${CMAKE_C_FLAGS}" )
|
||||
endif(UNIX)
|
||||
endif ()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue