From ba1dc4f9f40182e8fead4dcaf2056754c5932d7e Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 23 Oct 2021 15:56:57 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Relocate=20build=20flags=20/=20sett?= =?UTF-8?q?ings=20to=20the=20internal=20cmake=20space!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit — Closes #1209 --- CMakeLists.txt | 23 +++++++++++++++++++++++ cmake/Includes/Project.cmake | 25 ------------------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8da60454..ae72ab0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,6 +194,29 @@ if (sol2-is-top-level-project) set(CMAKE_C_STANDARD 11) endif() + # Build Flag Settings + # Basic/Normal flags + check_compiler_flag(disable-permissive MSVC /permissive- GCC -pedantic) + check_compiler_flag(utf8-literal-encoding MSVC /execution-charset:utf-8 GCC -fexec-charset=utf-8) + check_compiler_flag(utf8-source-encoding MSVC /source-charset:utf-8 GCC -finput-charset=utf-8) + check_compiler_flag(extra-constexpr-depth MSVC /constexpr:depth2147483647 GCC -fconstexpr-depth=2147483647 CLANG -fconstexpr-depth=2147483647) + check_compiler_flag(extra-constexpr-steps MSVC /constexpr:steps2147483647 GCC -fconstexpr-ops-limit=2147483647 CLANG -fconstexpr-steps=2147483647) + check_compiler_flag(template-debugging-mode GCC -ftemplate-backtrace-limit=0) + check_compiler_flag(big-obj MSVC /bigobj) + # Overall warning flags + check_compiler_flag(pedantic GCC -pedantic) + check_compiler_flag(warn-pedantic GCC -Wpedantic) + check_compiler_flag(warn-all MSVC /W4 GCC -Wall) + check_compiler_flag(warn-extra GCC -Wextra) + check_compiler_flag(warn-errors MSVC /WX GCC -Werror) + # Individual warnings/errors + check_compiler_diagnostic(unknown-warning) + check_compiler_diagnostic(unknown-warning-option) + check_compiler_diagnostic(microsoft-cast) + check_compiler_diagnostic(noexcept-type) + check_compiler_diagnostic(unreachable-code MSVC 4702) + check_compiler_diagnostic(padding-from-alignment MSVC 4324) + # # # Libraries # Here, we pull in all the necessary libraries for building examples and tests # Find threading library diff --git a/cmake/Includes/Project.cmake b/cmake/Includes/Project.cmake index 4ce2da0c..b121fdbe 100644 --- a/cmake/Includes/Project.cmake +++ b/cmake/Includes/Project.cmake @@ -50,28 +50,3 @@ include(CTest) include(CheckCompilerDiagnostic) include(CheckCompilerFlag) include(FindVersion) - -if (sol2-is-top-level-project) - # # Check environment/prepare generator expressions - # Basic/Normal flags - check_compiler_flag(disable-permissive MSVC /permissive- GCC -pedantic) - check_compiler_flag(utf8-literal-encoding MSVC /execution-charset:utf-8 GCC -fexec-charset=utf-8) - check_compiler_flag(utf8-source-encoding MSVC /source-charset:utf-8 GCC -finput-charset=utf-8) - check_compiler_flag(extra-constexpr-depth MSVC /constexpr:depth2147483647 GCC -fconstexpr-depth=2147483647 CLANG -fconstexpr-depth=2147483647) - check_compiler_flag(extra-constexpr-steps MSVC /constexpr:steps2147483647 GCC -fconstexpr-ops-limit=2147483647 CLANG -fconstexpr-steps=2147483647) - check_compiler_flag(template-debugging-mode GCC -ftemplate-backtrace-limit=0) - check_compiler_flag(big-obj MSVC /bigobj) - # Overall warning flags - check_compiler_flag(pedantic GCC -pedantic) - check_compiler_flag(warn-pedantic GCC -Wpedantic) - check_compiler_flag(warn-all MSVC /W4 GCC -Wall) - check_compiler_flag(warn-extra GCC -Wextra) - check_compiler_flag(warn-errors MSVC /WX GCC -Werror) - # Individual warnings/errors - check_compiler_diagnostic(unknown-warning) - check_compiler_diagnostic(unknown-warning-option) - check_compiler_diagnostic(microsoft-cast) - check_compiler_diagnostic(noexcept-type) - check_compiler_diagnostic(unreachable-code MSVC 4702) - check_compiler_diagnostic(padding-from-alignment MSVC 4324) -endif() \ No newline at end of file