Set CXX_STANDARD property for declared targets

CMake 3.8 provides the slightly cooler compile feature cxx_std_11, but
we are on 3.7 for now.
This commit is contained in:
Hermann von Kleist 2023-03-31 17:03:23 +02:00
commit cde35e2abf
2 changed files with 13 additions and 1 deletions

View file

@ -57,7 +57,7 @@ endif()
# If Simple-Web-Server is not a sub-project:
if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
if(NOT MSVC)
add_compile_options(-std=c++11 -Wall -Wextra)
add_compile_options(-Wall -Wextra)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wthread-safety)
endif()
@ -70,10 +70,12 @@ if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(http_examples http_examples.cpp)
target_link_libraries(http_examples simple-web-server)
target_link_libraries(http_examples Boost::boost Boost::system Boost::thread Boost::filesystem)
set_target_properties(http_examples PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
if(OPENSSL_FOUND)
add_executable(https_examples https_examples.cpp)
target_link_libraries(https_examples simple-web-server)
target_link_libraries(https_examples Boost::boost Boost::system Boost::thread Boost::filesystem)
set_target_properties(https_examples PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
endif()
endif()