mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[cmake] fix CheckAndSetFlag
Actually add the flags provided and not discard them.
This commit is contained in:
@@ -1,28 +1,31 @@
|
|||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
|
macro(RemoveFlag FLAG)
|
||||||
|
string(REPLACE "${FLAG}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
|
string(REPLACE "${FLAG}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
macro(CheckAndSetFlag FLAG)
|
macro(CheckAndSetFlag FLAG)
|
||||||
if(FLAG)
|
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
|
|
||||||
|
|
||||||
unset(C_FLAG)
|
unset(C_FLAG)
|
||||||
unset(CXX_FLAG)
|
unset(CXX_FLAG)
|
||||||
if("C" IN_LIST languages)
|
if("C" IN_LIST languages)
|
||||||
check_c_compiler_flag("${FLAG}" C_FLAG)
|
check_c_compiler_flag("${FLAG}" C_FLAG)
|
||||||
if(C_FLAG)
|
if(C_FLAG)
|
||||||
string(APPEND CMAKE_C_FLAGS " ${FLAG}")
|
string(APPEND CMAKE_C_FLAGS " ${FLAG}")
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if("CXX" IN_LIST languages)
|
|
||||||
check_cxx_compiler_flag("${FLAG}" CXX_FLAG)
|
|
||||||
if(CXX_FLAG)
|
|
||||||
string(APPEND CMAKE_CXX_FLAGS " ${FLAG}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT C_FLAG AND NOT CXX_FLAG)
|
|
||||||
message(WARNING "compiler does not support ${FLAG}")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if("CXX" IN_LIST languages)
|
||||||
|
check_cxx_compiler_flag("${FLAG}" CXX_FLAG)
|
||||||
|
if(CXX_FLAG)
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS " ${FLAG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT C_FLAG AND NOT CXX_FLAG)
|
||||||
|
message(WARNING "compiler does not support ${FLAG}")
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
|
|||||||
|
|
||||||
if(EXPORT_ALL_SYMBOLS)
|
if(EXPORT_ALL_SYMBOLS)
|
||||||
add_compile_definitions(EXPORT_ALL_SYMBOLS)
|
add_compile_definitions(EXPORT_ALL_SYMBOLS)
|
||||||
|
removeflag(-fvisibility=hidden)
|
||||||
else()
|
else()
|
||||||
message(STATUS "${} default symbol visibility: hidden")
|
message(STATUS "${} default symbol visibility: hidden")
|
||||||
|
|
||||||
checkandsetflag(-fvisibility=hidden)
|
checkandsetflag(-fvisibility=hidden)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user