Fix attempt to use -mno-direct-extern-access with Clang
Clang has the option, but spells it differently. Fixes: QTBUG-105002 Pick-to: 6.4 Change-Id: I36b24183fbd041179f2ffffd170217e82ff6d14d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
552605b0fc
commit
78ef9e9d14
@ -42,7 +42,8 @@ function(qt_internal_setup_public_platform_target)
|
||||
target_link_options(Platform INTERFACE "${libc_link_option}")
|
||||
endif()
|
||||
if (QT_FEATURE_no_extern_direct_access)
|
||||
target_compile_options(Platform INTERFACE "-mno-direct-extern-access")
|
||||
target_compile_options(Platform INTERFACE "$<$<CXX_COMPILER_ID:GNU>:-mno-direct-extern-access>")
|
||||
target_compile_options(Platform INTERFACE "$<$<CXX_COMPILER_ID:Clang>:-fno-direct-access-external-data>")
|
||||
endif()
|
||||
|
||||
qt_set_msvc_cplusplus_options(Platform INTERFACE)
|
||||
|
@ -5,5 +5,9 @@ project(direct_extern_access LANGUAGES CXX)
|
||||
|
||||
add_library(no_extern_access_lib SHARED lib.cpp)
|
||||
add_executable(no_extern_access_main main.cpp)
|
||||
target_compile_options(no_extern_access_lib PUBLIC "-mno-direct-extern-access")
|
||||
|
||||
target_compile_options(no_extern_access_lib PRIVATE "-Werror")
|
||||
target_compile_options(no_extern_access_lib PUBLIC "$<$<CXX_COMPILER_ID:GNU>:-mno-direct-extern-access>")
|
||||
target_compile_options(no_extern_access_lib PUBLIC "$<$<CXX_COMPILER_ID:Clang>:-fno-direct-access-external-data>")
|
||||
|
||||
target_link_libraries(no_extern_access_main no_extern_access_lib)
|
||||
|
@ -6,5 +6,6 @@
|
||||
#define BUILD
|
||||
#include "lib.h"
|
||||
|
||||
void *S::ptr = nullptr;
|
||||
S::~S() { }
|
||||
void S::f() { }
|
||||
void *S::f() { return ptr; }
|
||||
|
@ -12,5 +12,6 @@
|
||||
struct LIB_API S
|
||||
{
|
||||
virtual ~S();
|
||||
virtual void f();
|
||||
virtual void *f();
|
||||
static void *ptr;
|
||||
};
|
||||
|
@ -1,2 +1,7 @@
|
||||
QMAKE_CFLAGS += -mno-direct-extern-access
|
||||
QMAKE_CXXFLAGS += -mno-direct-extern-access
|
||||
clang {
|
||||
QMAKE_CFLAGS += -fno-direct-access-external-data
|
||||
QMAKE_CXXFLAGS += -fno-direct-access-external-data
|
||||
} else {
|
||||
QMAKE_CFLAGS += -mno-direct-extern-access
|
||||
QMAKE_CXXFLAGS += -mno-direct-extern-access
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user