|
1 | | -cmake_minimum_required(VERSION 3.0) |
| 1 | +cmake_minimum_required(VERSION 3.0.2) |
2 | 2 | project(Jinja2Cpp VERSION 0.5.0) |
3 | 3 |
|
4 | 4 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
@@ -55,10 +55,25 @@ target_link_libraries(${LIB_TARGET_NAME} PUBLIC ThirdParty::nonstd boost_variant |
55 | 55 | target_include_directories(${LIB_TARGET_NAME} |
56 | 56 | PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) |
57 | 57 |
|
| 58 | + |
58 | 59 | if(NOT MSVC) |
59 | | - target_compile_options(boost_assert INTERFACE -Wno-error=parentheses -Wno-parentheses) |
60 | | - target_compile_options(boost_filesystem PRIVATE -Wno-error=deprecated-declarations -Wno-deprecated-declarations) |
61 | | - target_compile_options(${LIB_TARGET_NAME} PRIVATE -Wall -Werror -Wno-error=maybe-uninitialized) |
| 60 | + # Enable -Werror and -Wall on jinja2cpp target, ignoring warning errors from thirdparty libs |
| 61 | + include(CheckCXXCompilerFlag) |
| 62 | + check_cxx_compiler_flag(-Wno-error=parentheses COMPILER_HAS_WNO_ERROR_PARENTHESES_FLAG) |
| 63 | + check_cxx_compiler_flag(-Wno-error=deprecated-declarations COMPILER_HAS_WNO_ERROR_DEPRECATED_DECLARATIONS_FLAG) |
| 64 | + check_cxx_compiler_flag(-Wno-error=maybe-uninitialized COMPILER_HAS_WNO_ERROR_MAYBE_UNINITIALIZED_FLAG) |
| 65 | + |
| 66 | + if(COMPILER_HAS_WNO_ERROR_PARENTHESES_FLAG) |
| 67 | + target_compile_options(boost_assert INTERFACE -Wno-error=parentheses) |
| 68 | + endif() |
| 69 | + if(COMPILER_HAS_WNO_ERROR_DEPRECATED_DECLARATIONS_FLAG) |
| 70 | + target_compile_options(boost_filesystem PRIVATE -Wno-error=deprecated-declarations) |
| 71 | + endif() |
| 72 | + if(COMPILER_HAS_WNO_ERROR_MAYBE_UNINITIALIZED_FLAG) |
| 73 | + target_compile_options(boost_variant INTERFACE -Wno-error=maybe-uninitialized) |
| 74 | + endif() |
| 75 | + |
| 76 | + target_compile_options(${LIB_TARGET_NAME} PRIVATE -Wall -Werror) |
62 | 77 | endif() |
63 | 78 |
|
64 | 79 | if (JINJA2CPP_BUILD_TESTS) |
|
0 commit comments