diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7261e5ce..e8ad7385 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -38,7 +38,7 @@ jobs: - name: setup-build env: CXX: ${{ matrix.compiler.cxx }} - run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_USE_LTO=ON + run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_USE_WERROR=ON -DGAPP_USE_LTO=ON - name: build run: cmake --build . --parallel 8 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5a43078c..bb76d3e0 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -44,7 +44,7 @@ jobs: run: sudo bash ./install_catch.sh -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_CXX_FLAGS="${{ matrix.compiler.extra-flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.compiler.linker-flags }}" - name: setup-build - run: cmake .. -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_CXX_FLAGS="${{ matrix.compiler.extra-flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.compiler.linker-flags }}" + run: cmake .. -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_CXX_FLAGS="${{ matrix.compiler.extra-flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.compiler.linker-flags }}" -DGAPP_USE_WERROR=ON - name: build run: cmake --build . --parallel 8 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e1b0327e..3844de30 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,8 +10,8 @@ jobs: matrix: build-type: [ Release, RelWithDebInfo ] platform: [ x64, Win32 ] - compiler: [ v143, ClangCL ] generator: [ "Visual Studio 17 2022" ] + compiler: [ v143, ClangCL ] build-shared: [ "ON", "OFF" ] exclude: - platform: Win32 @@ -45,7 +45,7 @@ jobs: CMAKE_GENERATOR: ${{ matrix.generator }} CMAKE_GENERATOR_TOOLSET: ${{ matrix.compiler }} CMAKE_GENERATOR_PLATFORM: ${{ matrix.platform }} - run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_SHARED_LIBS=${{ matrix.build-shared }} -DGAPP_USE_LTO=ON + run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_SHARED_LIBS=${{ matrix.build-shared }} -DGAPP_USE_WERROR=ON -DGAPP_USE_LTO=ON - name: build run: cmake --build . --parallel --config ${{ matrix.build-type }} diff --git a/CMakeLists.txt b/CMakeLists.txt index e51cf17e..d6e7242f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(CMakePackageConfigHelpers) option(GAPP_BUILD_TESTS "Build the tests for the library when ON." ON) option(GAPP_BUILD_BENCHMARKS "Build the benchmarks for the library when ON." OFF) option(GAPP_BUILD_EXAMPLES "Build the examples for the library when ON." OFF) -option(GAPP_USE_WERROR "Treat all warnings as errors during the build." ON) +option(GAPP_USE_WERROR "Treat all warnings as errors during the build." OFF) option(GAPP_USE_LTO "Use link time optimizations for the library (only used for optimized builds)." OFF) option(GAPP_USE_MARCH_NATIVE "Optimize for the host architecture in release builds (only used for gcc and clang)." OFF) option(GAPP_DISABLE_EXCEPTIONS "Disable exception support when building the library." OFF) diff --git a/CMakeSettings.json b/CMakeSettings.json index 0f1ae29e..753dee08 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -6,7 +6,7 @@ "configurationType": "Debug", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=/analyze:WX- -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=/analyze:WX- -DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "codeAnalysisRuleset": "${projectDir}\\core-guidelines.ruleset", "enableMicrosoftCodeAnalysis": false, @@ -18,7 +18,7 @@ "configurationType": "Release", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=-analyze:WX- -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=-analyze:WX- -DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "codeAnalysisRuleset": "${projectDir}\\core-guidelines.ruleset", "enableMicrosoftCodeAnalysis": false, @@ -30,7 +30,7 @@ "configurationType": "RelWithDebInfo", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=-analyze:WX- -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=-analyze:WX- -DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "codeAnalysisRuleset": "${projectDir}\\core-guidelines.ruleset", "enableMicrosoftCodeAnalysis": false, @@ -42,7 +42,7 @@ "configurationType": "Debug", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "enableClangTidyCodeAnalysis": false, "inheritEnvironments": [ "clang_cl_x64_x64" ] @@ -53,7 +53,7 @@ "configurationType": "Release", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "inheritEnvironments": [ "clang_cl_x64_x64" ] }, @@ -63,7 +63,7 @@ "configurationType": "RelWithDebInfo", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "inheritEnvironments": [ "clang_cl_x64_x64" ] }, @@ -73,7 +73,7 @@ "configurationType": "Release", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=-analyze:WX- -DBUILD_SHARED_LIBS=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=-analyze:WX- -DGAPP_USE_WERROR=ON -DBUILD_SHARED_LIBS=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "codeAnalysisRuleset": "${projectDir}\\core-guidelines.ruleset", "enableMicrosoftCodeAnalysis": false, @@ -85,7 +85,7 @@ "configurationType": "Release", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DBUILD_SHARED_LIBS=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", + "cmakeCommandArgs": "-DGAPP_USE_WERROR=ON -DBUILD_SHARED_LIBS=ON -DGAPP_BUILD_TESTS=ON -DGAPP_BUILD_BENCHMARKS=ON -DGAPP_BUILD_EXAMPLES=ON -DGAPP_USE_LTO=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "codeAnalysisRuleset": "${projectDir}\\core-guidelines.ruleset", "enableMicrosoftCodeAnalysis": false, @@ -97,7 +97,7 @@ "configurationType": "Debug", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_BUILD_TESTS=ON", + "cmakeCommandArgs": "-DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "inheritEnvironments": [ "clang_cl_x64_x64" ], "variables": [ @@ -113,7 +113,7 @@ "configurationType": "Debug", "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=/analyze:WX- -DGAPP_BUILD_TESTS=ON", + "cmakeCommandArgs": "-DGAPP_CXX_FLAGS=/analyze:WX- -DGAPP_USE_WERROR=ON -DGAPP_BUILD_TESTS=ON", "ctestCommandArgs": "--output-on-failure --schedule-random", "codeAnalysisRuleset": "${projectDir}\\core-guidelines.ruleset", "enableMicrosoftCodeAnalysis": true, diff --git a/conanfile.py b/conanfile.py index 506d1ad1..5c5d5759 100644 --- a/conanfile.py +++ b/conanfile.py @@ -29,6 +29,7 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["GAPP_BUILD_TESTS"] = False tc.variables["GAPP_USE_LTO"] = False + tc.variables["GAPP_USE_WERROR"] = False tc.generate() def build(self):