summaryrefslogtreecommitdiff
path: root/config.tests/no_direct_extern_access/CMakeLists.txt
blob: 7c8234875182be2a38108d6afddca4e39cd2759b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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

add_library(no_extern_access_lib SHARED lib.cpp)
add_executable(no_extern_access_main main.cpp)

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)