Fixes #301: Do not run add_compile_options when Simple-Web-Server is a sub-project

This commit is contained in:
eidheim 2020-06-26 18:51:22 +02:00
commit 8ee71cddbb

View file

@ -6,15 +6,6 @@ option(USE_STANDALONE_ASIO "set ON to use standalone Asio instead of Boost.Asio"
option(BUILD_TESTING "set ON to build library tests" OFF) option(BUILD_TESTING "set ON to build library tests" OFF)
option(USE_OPENSSL "set OFF to build without OpenSSL" ON) option(USE_OPENSSL "set OFF to build without OpenSSL" ON)
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wthread-safety)
endif()
else()
add_compile_options(/W1)
endif()
add_library(simple-web-server INTERFACE) add_library(simple-web-server INTERFACE)
target_include_directories(simple-web-server INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(simple-web-server INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
@ -61,6 +52,15 @@ endif()
# If Simple-Web-Server is not a sub-project: # If Simple-Web-Server is not a sub-project:
if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wthread-safety)
endif()
else()
add_compile_options(/W1)
endif()
find_package(Boost 1.53.0 COMPONENTS system thread filesystem) find_package(Boost 1.53.0 COMPONENTS system thread filesystem)
if(Boost_FOUND) if(Boost_FOUND)
add_executable(http_examples http_examples.cpp) add_executable(http_examples http_examples.cpp)