Instead of relying on fragile and complex logic to decide if a
compiler flag is available or not, use the check_c_compiler_flag()
macro provided by the CMake standard library.
This for example avoids using -fcf-protection on architectures that
don't support this option.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit dd2d181755a6e642c0a8e3225ef5407fff49eb3a)
When resolving the conflict from applying the patch, I also took the liberty
of re-indenting the snippet correcly and fixing mismatching
HAS_FCF_PROTECTION and HAS_FSTACK_PROTECTOR_STRONG variables
(the conditionals used GCC_ prefix but the variables were definded without it).
Signed-off-by: Jan Tojnar <jtojnar@gmail.com>
- Replacement of CMAKE_CXX_FLAGS by add_compile_option where it was
possible
- Addition of new compiler flags which are interesting in terms of
software security
- Do not mix coverage flags with -O0 and -g
We had issues to compile exiv2 due to a undefined symbol referenced in expat.lib (Explained in #487).
Static builds in Windows need to use msvcrt.lib where the missing symbol ("__imp__mbspbrk") was
defined. We can still decide to use the STATIC CRT library by using:
cmake -DBUILD_SHARED_LIBS=OFF -DEXIV2_ENABLE_DYNAMIC_RUNTIME=OFF
Setting this option enables address sanitizer and undefined behavior
sanitizer, when available for the given compiler & platform.
It does not currently check whether the architecture is supported,
as CMake does not offer an easy way how to check it. Since we are
mostly developing for x86 & amd64 this is not a huge problem and it's
also a developer only setting.
* [appveyor] Install clcache with nuget
* [appveyor] Keep clcache in the appveyor jobs
* [appveyor] Print clcache stats after compiling the project
* Use CLCACHE_PATH env variable to find clcache