Use system includes for asio and if used as subdirectory

This commit is contained in:
Hermann von Kleist 2023-03-31 11:08:36 +02:00
commit ee1a69ba4a

View file

@ -13,7 +13,11 @@ option(USE_OPENSSL "set OFF to build without OpenSSL" ON)
add_library(simple-web-server INTERFACE) add_library(simple-web-server INTERFACE)
target_include_directories(simple-web-server INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(simple-web-server INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
else()
target_include_directories(simple-web-server SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
endif()
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
target_link_libraries(simple-web-server INTERFACE Threads::Threads) target_link_libraries(simple-web-server INTERFACE Threads::Threads)
@ -24,7 +28,7 @@ if(USE_STANDALONE_ASIO)
if(NOT ASIO_PATH) if(NOT ASIO_PATH)
message(FATAL_ERROR "Standalone Asio not found") message(FATAL_ERROR "Standalone Asio not found")
else() else()
target_include_directories(simple-web-server INTERFACE ${ASIO_PATH}) target_include_directories(simple-web-server SYSTEM INTERFACE ${ASIO_PATH})
endif() endif()
else() else()
find_package(Boost 1.53.0 COMPONENTS system thread REQUIRED) find_package(Boost 1.53.0 COMPONENTS system thread REQUIRED)