diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/compiler/clang/settings.cmake | 5 | ||||
-rw-r--r-- | cmake/compiler/gcc/settings.cmake | 5 | ||||
-rw-r--r-- | cmake/compiler/msvc/settings.cmake | 8 | ||||
-rw-r--r-- | cmake/macros/ConfigureBaseTargets.cmake | 30 |
4 files changed, 34 insertions, 14 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake index 204cc6d245a..5ccacbf9888 100644 --- a/cmake/compiler/clang/settings.cmake +++ b/cmake/compiler/clang/settings.cmake @@ -41,7 +41,10 @@ if (BUILD_SHARED_LIBS) # -fvisibility=hidden sets the default visibility to hidden to prevent exporting of all symbols. target_compile_options(trinity-compile-option-interface INTERFACE - -fPIC + -fPIC) + + target_compile_options(trinity-hidden-symbols-interface + INTERFACE -fvisibility=hidden) # --no-undefined to throw errors when there are undefined symbols diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake index d854ff521ce..9139a028f18 100644 --- a/cmake/compiler/gcc/settings.cmake +++ b/cmake/compiler/gcc/settings.cmake @@ -48,9 +48,12 @@ if (BUILD_SHARED_LIBS) target_compile_options(trinity-compile-option-interface INTERFACE -fPIC - -fvisibility=hidden -Wno-attributes) + target_compile_options(trinity-hidden-symbols-interface + INTERFACE + -fvisibility=hidden) + # Should break the build when there are TRINITY_*_API macros missing # but it complains about missing references in precompiled headers. # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--no-undefined") diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index eec3857e0d8..96197688d58 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -110,13 +110,13 @@ message(STATUS "MSVC: Disabled POSIX warnings") # Ignore specific warnings # C4351: new behavior: elements of array 'x' will be default initialized # C4091: 'typedef ': ignored on left of '' when no variable is declared -target_compile_options(trinity-warning-interface +target_compile_options(trinity-compile-option-interface INTERFACE /wd4351 /wd4091) if(NOT WITH_WARNINGS) - target_compile_options(trinity-warning-interface + target_compile_options(trinity-compile-option-interface INTERFACE /wd4996 /wd4355 @@ -132,7 +132,7 @@ endif() if (BUILD_SHARED_LIBS) # C4251: needs to have dll-interface to be used by clients of class '...' # C4275: non dll-interface class ...' used as base for dll-interface class '...' - target_compile_options(trinity-warning-interface + target_compile_options(trinity-compile-option-interface INTERFACE /wd4251 /wd4275) @@ -143,7 +143,7 @@ endif() # Enable and treat as errors the following warnings to easily detect virtual function signature failures: # 'function' : member function does not override any base class virtual member function # 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden -target_compile_options(trinity-warning-interface +target_compile_options(trinity-compile-option-interface INTERFACE /we4263 /we4264) diff --git a/cmake/macros/ConfigureBaseTargets.cmake b/cmake/macros/ConfigureBaseTargets.cmake index 1c85c512ad2..0166185b3be 100644 --- a/cmake/macros/ConfigureBaseTargets.cmake +++ b/cmake/macros/ConfigureBaseTargets.cmake @@ -37,29 +37,43 @@ target_compile_features(trinity-feature-interface # This interface taget is set-up through the platform specific script add_library(trinity-warning-interface INTERFACE) -# An interface amalgamation which provides the flags and definitions -# used by the dependency targets. -add_library(trinity-dependency-interface INTERFACE) -target_link_libraries(trinity-dependency-interface +# An interface used for all other interfaces +add_library(trinity-default-interface INTERFACE) +target_link_libraries(trinity-default-interface INTERFACE trinity-compile-option-interface trinity-feature-interface) +# An interface used for silencing all warnings +add_library(trinity-no-warning-interface INTERFACE) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(trinity-dependency-interface + target_compile_options(trinity-no-warning-interface INTERFACE /W0) else() - target_compile_options(trinity-dependency-interface + target_compile_options(trinity-no-warning-interface INTERFACE -w) endif() +# An interface library to change the default behaviour +# to hide symbols automatically. +add_library(trinity-hidden-symbols-interface INTERFACE) + +# An interface amalgamation which provides the flags and definitions +# used by the dependency targets. +add_library(trinity-dependency-interface INTERFACE) +target_link_libraries(trinity-dependency-interface + INTERFACE + trinity-default-interface + trinity-no-warning-interface + trinity-hidden-symbols-interface) + # An interface amalgamation which provides the flags and definitions # used by the core targets. add_library(trinity-core-interface INTERFACE) target_link_libraries(trinity-core-interface INTERFACE - trinity-compile-option-interface - trinity-feature-interface + trinity-default-interface trinity-warning-interface) |