mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Allow users to remove SYSTEM keyword because it forces C linkage for some gcc versions. (#574)
Co-authored-by: MacGregor, Andy <amacgregor@irobot.com>
This commit is contained in:
parent
841f4610d0
commit
e88f32d565
@ -15,13 +15,22 @@ project(etl VERSION ${ETL_VERSION})
|
||||
|
||||
option(BUILD_TESTS "Build unit tests" OFF)
|
||||
option(NO_STL "No STL" OFF)
|
||||
# There is a bug on old gcc versions for some targets that causes all system headers
|
||||
# to be implicitly wrapped with 'extern "C"'
|
||||
# Users can add set(NO_SYSTEM_INCLUDE ON) to their top level CMakeLists.txt to work around this.
|
||||
option(NO_SYSTEM_INCLUDE "Do not include with -isystem" OFF)
|
||||
if (NO_SYSTEM_INCLUDE)
|
||||
set(INCLUDE_SPECIFIER "")
|
||||
else()
|
||||
set(INCLUDE_SPECIFIER "SYSTEM")
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
# This allows users which use the add_subdirectory or FetchContent
|
||||
# to use the same target as users which use find_package
|
||||
add_library(etl::etl ALIAS ${PROJECT_NAME})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE
|
||||
target_include_directories(${PROJECT_NAME} ${INCLUDE_SPECIFIER} INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user