ruslo / Leathers
Licence: bsd-2-clause
🚀 Warning suppression library (C++)
Stars: ✭ 78
Labels
Projects that are alternatives of or similar to Leathers
Kaidan
[Replaced by https://invent.kde.org/network/kaidan] Kaidan, a simple and user-friendly Jabber/XMPP client for every device and platform.
Stars: ✭ 67 (-14.1%)
Mutual labels: cmake
Magnum Bootstrap
Bootstrap projects for Magnum C++11/C++14 graphics engine
Stars: ✭ 69 (-11.54%)
Mutual labels: cmake
Vs.language.cmake
Syntax highlighting for Cmake in Visual Studio Code
Stars: ✭ 64 (-17.95%)
Mutual labels: cmake
Ncnn Benchmark
The benchmark of ncnn that is a high-performance neural network inference framework optimized for the mobile platform
Stars: ✭ 70 (-10.26%)
Mutual labels: cmake
Openssl Cmake
Build OpenSSL with CMake on MacOS, Win32, Win64 and cross compile for Android, IOS
Stars: ✭ 76 (-2.56%)
Mutual labels: cmake
Nitroshare Desktop
Network file transfer application for Windows, OS X, & Linux
Stars: ✭ 1,150 (+1374.36%)
Mutual labels: cmake
Didi challenge ros
Roslaunch to visualize a rosbag file from Udacity (DiDi Challenge)
Stars: ✭ 69 (-11.54%)
Mutual labels: cmake
Helloworld
A C++ Hello World project, using CMake, and GitHub Actions
Stars: ✭ 77 (-1.28%)
Mutual labels: cmake
Magnum Plugins
Plugins for the Magnum C++11/C++14 graphics engine
Stars: ✭ 66 (-15.38%)
Mutual labels: cmake
Findtbb
CMake find module for Intel Threading Building Blocks
Stars: ✭ 77 (-1.28%)
Mutual labels: cmake
leathers
This C++ header only library helps to save some space while ignoring compiler warnings by pragma pop/push mechanism.
Example
Some mix-compiler code:
#if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable : 4511 4512)
#elif defined(BOOST_CLANG)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wexit-time-destructors"
#endif
// some code
#if defined(BOOST_MSVC)
# pragma warning(pop)
#elif defined(BOOST_CLANG)
# pragma clang diagnostic pop
#endif
12 lines of code for 2 compilers to ignore warning in 1 line.
Using this library:
#include <leathers/push>
#include <leathers/exit-time-destructors>
// some code
#include <leathers/pop>
3 lines of code for any number of compilers to ignore warning in 1 line.
Example (all)
Suppressing warnings in third party libraries:
#include <leathers/push>
#include <leathers/all>
# include <third_party/library1/headerA>
# include <third_party/library2/headerB>
#include <leathers/pop>
Usage (manual install)
- Install
boost
(predef
library) - Add
Source
directory to compiler include option:-I${LEATHERS_ROOT}/Source
> cat foo.cpp
#include <cstdio> // std::printf
int main() {
const char* fmt = "%d";
#include <leathers/push>
#include <leathers/format>
std::printf(fmt, 1);
#include <leathers/pop>
}
> clang++ -I${BOOST_ROOT}/include -I${LEATHERS_ROOT}/Source -Weverything foo.cpp
Usage (CMake, hunter package manager)
Leathers
can be installed using hunter package manager:
> cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(Foo)
include(HunterGate.cmake)
hunter_add_package(Leathers)
find_package(Leathers CONFIG REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Werror")
add_executable(foo foo.cpp)
target_link_libraries(foo leathers)
> cat foo.cpp
#include <cstdio> // std::printf
int main() {
const char* fmt = "%d";
#include <leathers/push>
#include <leathers/format>
std::printf(fmt, 1);
#include <leathers/pop>
}
> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON
> cmake --build _builds
Note that boost installed automatically
CMake (companion function to generate warning flags)
This function can be used to generate cross-platform target flags and properties:
> cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(Foo)
include(HunterGate.cmake)
hunter_add_package(Leathers)
hunter_add_package(Sugar)
find_package(Leathers CONFIG REQUIRED)
include(${SUGAR_ROOT}/cmake/Sugar)
include(sugar_generate_warning_flags)
sugar_generate_warning_flags(
flags properties ENABLE ALL TREAT_AS_ERROR ALL CLEAR_GLOBAL
)
add_executable(foo foo.cpp)
target_link_libraries(foo leathers)
set_target_properties(
foo PROPERTIES ${properties} COMPILE_OPTIONS "${flags}"
)
> cat foo.cpp
#include <cstdio> // std::printf
int main() {
const char* fmt = "%d";
#include <leathers/push>
#include <leathers/format>
std::printf(fmt, 1);
#include <leathers/pop>
}
> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON
> cmake --build _builds
Wiki
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].