Fixed issue with compiler options

This commit is contained in:
Michele Adduci 2021-01-11 06:59:32 +01:00
parent 3cb9222054
commit 96e1b2c157
5 changed files with 10 additions and 8 deletions

View File

@ -30,8 +30,8 @@ option(BUILD_TESTING "Builds the tests in the project" OFF)
#####################################
# Define CMake Module Imports
#####################################
include(${CMAKE_SOURCE_DIR}/cmake/compiler_options.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/dependencies.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/compiler_options.cmake)
#####################################
# Define project-wide imports

View File

@ -23,6 +23,3 @@ else(MSVC)
$<$<CONFIG:DEBUG>:-pg>)
endif()
# This can also be done with target_compile_options() [recommended]
set(CMAKE_CXX_FLAGS "${compiler_options}")

View File

@ -23,7 +23,6 @@ if(BUILD_EXAMPLES OR BUILD_TESTING)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIR})
endif()
endif()
if(BUILD_EXAMPLES)

View File

@ -9,17 +9,21 @@ list(APPEND REQUIRED_LIBRARIES
if (MSVC)
add_executable(example_vs example_vs.cpp)
target_compile_options(example_vs PRIVATE "${compiler_options}")
target_link_libraries(example_vs )
else ()
add_executable(helloworld helloworld.cpp)
target_compile_options(helloworld PRIVATE "${compiler_options}")
target_link_libraries(helloworld PUBLIC ${REQUIRED_LIBRARIES})
if (OPENSSL_FOUND)
add_executable(example_ssl ssl/example_ssl.cpp)
target_compile_options(example_ssl PRIVATE "${compiler_options}")
target_link_libraries(example_ssl PUBLIC ${REQUIRED_LIBRARIES} ${OPENSSL_LIBRARIES})
endif()
add_executable(example_websocket websocket/example_ws.cpp)
target_compile_options(example_websocket PRIVATE "${compiler_options}")
target_link_libraries(example_websocket )
target_link_libraries(example_websocket PUBLIC ${REQUIRED_LIBRARIES})
add_custom_command(OUTPUT ws.html
@ -30,6 +34,7 @@ else ()
add_custom_target(example_ws_copy ALL DEPENDS ws.html)
add_executable(basic_example example.cpp)
target_compile_options(basic_example PRIVATE "${compiler_options}")
target_link_libraries(basic_example PUBLIC ${REQUIRED_LIBRARIES})
if (Tcmalloc_FOUND)
@ -38,6 +43,7 @@ else ()
add_executable(example_with_all example_with_all.cpp)
add_dependencies(example_with_all amalgamation)
target_compile_options(example_with_all PRIVATE "${compiler_options}")
target_link_libraries(example_with_all PUBLIC ${REQUIRED_LIBRARIES})
add_custom_command(OUTPUT example_test.py
@ -48,6 +54,7 @@ else ()
add_custom_target(example_copy ALL DEPENDS example_test.py)
add_executable(example_chat example_chat.cpp)
target_compile_options(example_chat PRIVATE "${compiler_options}")
target_link_libraries(example_chat PUBLIC ${REQUIRED_LIBRARIES})
add_custom_command(OUTPUT example_chat.html

View File

@ -10,8 +10,7 @@ set(TEST_SRCS
)
add_executable(mustachetest ${TEST_SRCS})
set_target_properties(mustachetest PROPERTIES COMPILE_FLAGS "-Wall -Werror -std=c++14")
target_compile_options(mustachetest PRIVATE "${compiler_options}")
file(COPY DIRECTORY . DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILES_MATCHING PATTERN "*.json")
add_custom_command(OUTPUT test.py