Open kloczek opened 4 months ago
And build fails with
All those warnings are turned ito eerors because
[tkloczko@pers-jacek glm-1.0.1]$ grep -r -- -Werror
test/CMakeLists.txt: add_compile_options(-Werror -Weverything)
test/CMakeLists.txt: add_compile_options(-Werror)
After add JFDI patch
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,61 +3,6 @@
option(GLM_TEST_ENABLE "Build unit tests" ON)
option(GLM_PERF_TEST_ENABLE "Build perf tests" OFF)
-# Compiler and default options
-
-if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- if(NOT GLM_QUIET)
- message("GLM: Clang - ${CMAKE_CXX_COMPILER_ID} compiler")
- endif()
-
- if(NOT GLM_DISABLE_AUTO_DETECTION)
- add_compile_options(-Werror -Weverything)
- endif()
-
-elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- if(NOT GLM_QUIET)
- message("GLM: GCC - ${CMAKE_CXX_COMPILER_ID} compiler")
- endif()
-
- if(NOT GLM_DISABLE_AUTO_DETECTION)
- add_compile_options(-Werror)
-# add_compile_options(-Wpedantic)
-# add_compile_options(-Wall)
-# add_compile_options(-Wextra)
- endif()
- add_compile_options(-O2)
- #add_compile_options(-Wno-long-long)
-elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
- if(NOT GLM_QUIET)
- message("GLM: Intel - ${CMAKE_CXX_COMPILER_ID} compiler")
- endif()
-
-elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
- if(NOT GLM_QUIET)
- message("GLM: Visual C++ - ${CMAKE_CXX_COMPILER_ID} compiler")
- endif()
-
- if(NOT GLM_DISABLE_AUTO_DETECTION)
- add_compile_options(/Wall /WX)
- add_compile_options(/wd4464) # warning C4464: relative include path contains '..'
- add_compile_options(/wd4514) # warning C4514: unreferenced inline function has been removed
- add_compile_options(/wd4365) # warning C4365: signed/unsigned mismatch
- add_compile_options(/wd5045) # warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
- add_compile_options(/wd5029) # warning C5029: nonstandard extension used: alignment attributes in C++ apply to variables, data members and tag types only
- add_compile_options(/wd4820) # warning C4820: 'test_decl::S1': '3' bytes padding added after data member 'test_decl::S1::A'
- add_compile_options(/wd4710) # warning C4710: 'std::string glm::detail::format(const char *,...)': function not inlined
- add_compile_options(/wd4626) # warning C4626: 'glm::io::format_punct<CTy>': assignment operator was implicitly defined as deleted
- add_compile_options(/wd4711) # warning C4711: function 'int __cdecl test_vec1(void)' selected for automatic inline expansion
- add_compile_options(/wd4571) # warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
- add_compile_options(/wd4625) # warning C4625: 'std::codecvt_base': copy constructor was implicitly defined as deleted
- add_compile_options(/wd5026) # warning C5026: 'std::_Generic_error_category': move constructor was implicitly defined as deleted
- add_compile_options(/wd5027) # warning C5027: 'std::_Generic_error_category': move assignment operator was implicitly defined as deleted
- add_compile_options(/wd4774) # warning C4774: 'sprintf_s' : format string expected in argument 3 is not a string literal
- endif()
-# add_compile_options(/wd4309 /wd4324 /wd4389 /wd4127 /wd4267 /wd4146 /wd4201 /wd4464 /wd4514 /wd4701 /wd4820 /wd4365)
- add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-endif()
-
function(glmCreateTestGTC NAME)
set(SAMPLE_NAME test-${NAME})
add_executable(${SAMPLE_NAME} ${NAME}.cpp)
I was able to build glm. All those lines are not needed because all needed compile time flags can be passed over $CFLAGS env variable on cmake execution. IMO that part should be removed and warnings cleaned.
Looks like test suite is OK. Summary compile time warnings stats:
[tkloczko@pers-jacek SPECS]$ rpmbuild -ba glm.spec --quiet 2>&1 | grep -- \\[-W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
75 -Wclass-memaccess
40 -Wsign-compare
12 -Wsequence-point
5 -Wunused-variable
2 -Wunused-but-set-variable
cmake settigs
"cmake -L" output:
```console -- Cache values BUILD_TESTING:BOOL=ON CMAKE_BUILD_TYPE:STRING=RelWithDebInfo CMAKE_INSTALL_PREFIX:PATH=/usr GLM_BUILD_INSTALL:BOOL=ON GLM_BUILD_LIBRARY:BOOL=ON GLM_BUILD_TESTS:BOOL=ON GLM_DISABLE_AUTO_DETECTION:BOOL=OFF GLM_ENABLE_CXX_11:BOOL=OFF GLM_ENABLE_CXX_14:BOOL=OFF GLM_ENABLE_CXX_17:BOOL=OFF GLM_ENABLE_CXX_20:BOOL=OFF GLM_ENABLE_CXX_98:BOOL=OFF GLM_ENABLE_FAST_MATH:BOOL=OFF GLM_ENABLE_LANG_EXTENSIONS:BOOL=OFF GLM_ENABLE_SIMD_AVX:BOOL=OFF GLM_ENABLE_SIMD_AVX2:BOOL=OFF GLM_ENABLE_SIMD_SSE2:BOOL=OFF GLM_ENABLE_SIMD_SSE3:BOOL=OFF GLM_ENABLE_SIMD_SSE4_1:BOOL=OFF GLM_ENABLE_SIMD_SSE4_2:BOOL=OFF GLM_ENABLE_SIMD_SSSE3:BOOL=OFF GLM_FORCE_PURE:BOOL=OFF GLM_PERF_TEST_ENABLE:BOOL=OFF GLM_QUIET:BOOL=OFF GLM_TEST_ENABLE:BOOL=ON ```