summaryrefslogtreecommitdiffstats
path: root/Tests/IncludeDirectoriesCPATH/CMakeLists.txt
blob: 31cbc3680a113833340371d363e99cc035527ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cmake_minimum_required (VERSION 3.14)
project(IncludeDirectoriesCPATH CXX)
message(STATUS "ENV{CPATH}: '$ENV{CPATH}'")
message(STATUS "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: '${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}'")

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test)
if(run_sys_includes_test)
  # The Bullseye wrapper appears to break the -isystem effect.
  execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out ERROR_VARIABLE out)
  if("x${out}" MATCHES "Bullseye")
    set(run_sys_includes_test 0)
  endif()
endif()
if (NOT run_sys_includes_test)
  return()
endif()

add_library(consumer consumer.cpp)
add_library(consumer_system consumer.cpp)
target_compile_options(consumer_system PRIVATE -Werror=unused-variable)
target_include_directories(consumer_system SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/viacpath")