Debian Codegraph @

tests/test_cmake_subdir/CMakeLists.txt

raw
1 cmake_minimum_required(VERSION 3.14)
2 project(test_parent LANGUAGES C)
3
4 add_subdirectory(${ABPOA_SOURCE_DIR} abpoa_build)
5
6 add_executable(test_parent test_parent.c)
7 target_link_libraries(test_parent abpoa)
8
9 # Check that abpoa's PUBLIC include directories expose include/ not src/
10 get_target_property(ABPOA_IFACE_DIRS abpoa INTERFACE_INCLUDE_DIRECTORIES)
11 string(FIND "${ABPOA_IFACE_DIRS}" "/src>" _src_pos)
12 if(NOT _src_pos EQUAL -1)
13 message(FATAL_ERROR
14 "abpoa leaks internal src/ headers to consumers via PUBLIC include: ${ABPOA_IFACE_DIRS}")
15 endif()
16
17 # Check that CMAKE_C_FLAGS was NOT polluted with -march=native
18 if(CMAKE_C_FLAGS MATCHES "-march=native")
19 message(FATAL_ERROR
20 "CMAKE_C_FLAGS polluted with -march=native: '${CMAKE_C_FLAGS}'")
21 endif()