mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Only use -Werror for our code
This commit is contained in:
parent
96ad385331
commit
d9aac3ee19
1 changed files with 303 additions and 302 deletions
|
@ -6,12 +6,10 @@ option(ASAN "Compile with address sanitizers" OFF)
|
||||||
option(QML_DEBUGGING "Enable qml debugging" OFF)
|
option(QML_DEBUGGING "Enable qml debugging" OFF)
|
||||||
|
|
||||||
set(
|
set(
|
||||||
CMAKE_TOOLCHAIN_FILE
|
CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
|
|
||||||
CACHE
|
CACHE
|
||||||
FILEPATH
|
FILEPATH "Default toolchain"
|
||||||
"Default toolchain"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
option(HUNTER_ENABLED "Enable Hunter package manager" OFF)
|
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"
|
URL "https://github.com/cpp-pm/hunter/archive/v0.23.244.tar.gz"
|
||||||
SHA1 "2c0f491fd0b80f7b09e3d21adb97237161ef9835"
|
SHA1 "2c0f491fd0b80f7b09e3d21adb97237161ef9835"
|
||||||
LOCAL
|
LOCAL
|
||||||
)
|
)
|
||||||
|
|
||||||
option(USE_BUNDLED_BOOST "Use the bundled version of Boost." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_BOOST "Use the bundled version of Boost." ${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog."
|
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog."
|
||||||
|
@ -121,9 +119,9 @@ if (APPLE)
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
if (Qt5Widgets_FOUND)
|
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(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()
|
||||||
endif(Qt5Widgets_FOUND)
|
endif(Qt5Widgets_FOUND)
|
||||||
|
|
||||||
|
@ -146,9 +144,6 @@ if(NOT MSVC)
|
||||||
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328
|
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
||||||
endif()
|
endif()
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR CI_BUILD)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
@ -285,7 +280,7 @@ set(SRC_FILES
|
||||||
src/UserSettingsPage.cpp
|
src/UserSettingsPage.cpp
|
||||||
src/WelcomePage.cpp
|
src/WelcomePage.cpp
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
@ -361,7 +356,7 @@ set_package_properties(nlohmann_json PROPERTIES
|
||||||
DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class"
|
DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class"
|
||||||
URL "https://nlohmann.github.io/json/"
|
URL "https://nlohmann.github.io/json/"
|
||||||
TYPE REQUIRED
|
TYPE REQUIRED
|
||||||
)
|
)
|
||||||
|
|
||||||
if(USE_BUNDLED_LMDBXX)
|
if(USE_BUNDLED_LMDBXX)
|
||||||
hunter_add_package(lmdbxx)
|
hunter_add_package(lmdbxx)
|
||||||
|
@ -469,7 +464,7 @@ qt5_wrap_cpp(MOC_HEADERS
|
||||||
src/UserInfoWidget.h
|
src/UserInfoWidget.h
|
||||||
src/UserSettingsPage.h
|
src/UserSettingsPage.h
|
||||||
src/WelcomePage.h
|
src/WelcomePage.h
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bundle translations.
|
# Bundle translations.
|
||||||
|
@ -477,30 +472,6 @@ qt5_wrap_cpp(MOC_HEADERS
|
||||||
include(Translations)
|
include(Translations)
|
||||||
set(TRANSLATION_DEPS ${LANG_QRC} ${QRC} ${QM_SRC})
|
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)
|
if (APPLE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa")
|
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)
|
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")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
|
target_link_libraries (nheko PRIVATE Qt5::MacExtras)
|
||||||
target_link_libraries (nheko ${NHEKO_LIBS} Qt5::MacExtras)
|
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
add_executable (nheko ${OS_BUNDLE} ${ICON_FILE} ${NHEKO_DEPS})
|
|
||||||
target_compile_definitions(nheko PRIVATE WIN32_LEAN_AND_MEAN)
|
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()
|
else()
|
||||||
add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
|
target_link_libraries (nheko PRIVATE Qt5::DBus)
|
||||||
target_link_libraries (nheko ${NHEKO_LIBS} Qt5::DBus)
|
|
||||||
endif()
|
endif()
|
||||||
target_include_directories(nheko PRIVATE src includes)
|
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)
|
if(QML_DEBUGGING)
|
||||||
target_compile_definitions(nheko PRIVATE QML_DEBUGGING)
|
target_compile_definitions(nheko PRIVATE QML_DEBUGGING)
|
||||||
endif()
|
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)
|
set_target_properties(nheko PROPERTIES SKIP_BUILD_RPATH TRUE)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
|
|
Loading…
Reference in a new issue