2022-05-23 16:14:54 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(direct_extern_access LANGUAGES CXX)
|
|
|
|
|
|
|
|
# this is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087
|
2022-07-18 18:01:18 +00:00
|
|
|
# and https://sourceware.org/bugzilla/show_bug.cgi?id=29377
|
2022-05-23 16:14:54 +00:00
|
|
|
|
|
|
|
add_library(no_extern_access_lib SHARED lib.cpp)
|
2022-07-18 18:01:18 +00:00
|
|
|
add_executable(no_extern_access_main other.cpp main.cpp)
|
2022-07-15 19:38:18 +00:00
|
|
|
|
|
|
|
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>")
|
|
|
|
|
2022-05-23 16:14:54 +00:00
|
|
|
target_link_libraries(no_extern_access_main no_extern_access_lib)
|