Only use -Werror for our code

This commit is contained in:
Nicolas Werner 2020-01-25 00:58:22 +01:00
parent 96ad385331
commit d9aac3ee19

View file

@ -6,12 +6,10 @@ option(ASAN "Compile with address sanitizers" OFF)
option(QML_DEBUGGING "Enable qml debugging" OFF)
set(
CMAKE_TOOLCHAIN_FILE
"${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
CACHE
FILEPATH
"Default toolchain"
)
FILEPATH "Default toolchain"
)
option(HUNTER_ENABLED "Enable Hunter package manager" OFF)
@ -20,7 +18,7 @@ HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.244.tar.gz"
SHA1 "2c0f491fd0b80f7b09e3d21adb97237161ef9835"
LOCAL
)
)
option(USE_BUNDLED_BOOST "Use the bundled version of Boost." ${HUNTER_ENABLED})
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog."
@ -121,9 +119,9 @@ if (APPLE)
endif(APPLE)
if (Qt5Widgets_FOUND)
if (Qt5Widgets_VERSION VERSION_LESS 5.7.0)
if (Qt5Widgets_VERSION VERSION_LESS 5.9.0)
message(STATUS "Qt version ${Qt5Widgets_VERSION}")
message(WARNING "Minimum supported Qt5 version is 5.7!")
message(WARNING "Minimum supported Qt5 version is 5.9!")
endif()
endif(Qt5Widgets_FOUND)
@ -146,9 +144,6 @@ if(NOT MSVC)
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR CI_BUILD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
endif()
if (MSVC)
@ -285,7 +280,7 @@ set(SRC_FILES
src/UserSettingsPage.cpp
src/WelcomePage.cpp
src/main.cpp
)
)
include(FeatureSummary)
@ -361,7 +356,7 @@ set_package_properties(nlohmann_json PROPERTIES
DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class"
URL "https://nlohmann.github.io/json/"
TYPE REQUIRED
)
)
if(USE_BUNDLED_LMDBXX)
hunter_add_package(lmdbxx)
@ -469,7 +464,7 @@ qt5_wrap_cpp(MOC_HEADERS
src/UserInfoWidget.h
src/UserSettingsPage.h
src/WelcomePage.h
)
)
#
# Bundle translations.
@ -477,30 +472,6 @@ qt5_wrap_cpp(MOC_HEADERS
include(Translations)
set(TRANSLATION_DEPS ${LANG_QRC} ${QRC} ${QM_SRC})
set(COMMON_LIBS
MatrixClient::MatrixClient
Boost::iostreams
Boost::system
Boost::thread
cmark::cmark
spdlog::spdlog
Qt5::Widgets
Qt5::Svg
Qt5::Concurrent
Qt5::Multimedia
Qt5::Qml
Qt5::QuickControls2
Qt5::QuickWidgets
nlohmann_json::nlohmann_json
lmdbxx::lmdbxx
tweeny)
if(USE_BUNDLED_LMDB)
set(NHEKO_LIBS ${COMMON_LIBS} liblmdb::lmdb)
else()
set(NHEKO_LIBS ${COMMON_LIBS} PkgConfig::lmdb)
endif()
if (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa")
set(SRC_FILES ${SRC_FILES} src/notifications/ManagerMac.mm src/emoji/MacHelper.mm)
@ -531,23 +502,53 @@ if(ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined")
endif()
add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
if(APPLE)
add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
target_link_libraries (nheko ${NHEKO_LIBS} Qt5::MacExtras)
target_link_libraries (nheko PRIVATE Qt5::MacExtras)
elseif(WIN32)
add_executable (nheko ${OS_BUNDLE} ${ICON_FILE} ${NHEKO_DEPS})
target_compile_definitions(nheko PRIVATE WIN32_LEAN_AND_MEAN)
target_link_libraries (nheko ${NTDLIB} ${NHEKO_LIBS} Qt5::WinMain)
target_link_libraries (nheko PRIVATE ${NTDLIB} Qt5::WinMain)
else()
add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
target_link_libraries (nheko ${NHEKO_LIBS} Qt5::DBus)
target_link_libraries (nheko PRIVATE Qt5::DBus)
endif()
target_include_directories(nheko PRIVATE src includes)
target_link_libraries(nheko PRIVATE
MatrixClient::MatrixClient
Boost::iostreams
Boost::system
Boost::thread
cmark::cmark
spdlog::spdlog
Qt5::Widgets
Qt5::Svg
Qt5::Concurrent
Qt5::Multimedia
Qt5::Qml
Qt5::QuickControls2
Qt5::QuickWidgets
nlohmann_json::nlohmann_json
lmdbxx::lmdbxx
tweeny)
if(USE_BUNDLED_LMDB)
target_link_libraries(nheko PRIVATE liblmdb::lmdb)
else()
target_link_libraries(nheko PRIVATE PkgConfig::lmdb)
endif()
if(QML_DEBUGGING)
target_compile_definitions(nheko PRIVATE QML_DEBUGGING)
endif()
if(NOT MSVC)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR CI_BUILD)
target_compile_options(nheko PRIVATE "-Werror")
endif()
endif()
set_target_properties(nheko PROPERTIES SKIP_BUILD_RPATH TRUE)
if(UNIX AND NOT APPLE)