Skip to content

Commit

Permalink
Add wish_werror
Browse files Browse the repository at this point in the history
  • Loading branch information
VaderDev committed Jul 26, 2023
1 parent e23ba88 commit cfcd28a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ TODO: Format, place
TODO: Auto self update the wish.cmake script (not just the wish/ folder)

- v5.4.4
- Feature: Add wish_werror
- Improvement: Hide package_* target for non-package build types
- v5.4.3
- Improvement: Add PLUGIN support for wish_generator
Expand Down Expand Up @@ -112,7 +113,7 @@ wish_configurations
wish_configurations(DEFAULT <default mode> <other modes>...)
# Example
wish_configurations(DEFAULT Release Dev Debug)
wish_configurations(debug dev DEFAULT release package)
```

wish_force_colored_output
Expand All @@ -133,6 +134,15 @@ option(MY_PROJECT_SKIP_EXTERNAL_CONFIGURES "Do not configure external projects o
wish_skip_external_configures(${MY_PROJECT_SKIP_EXTERNAL_CONFIGURES})
```

wish_werror
```
wish_werror(<bool>)
# Example
option(MY_PROJECT_WERROR "Specify whether to treat warnings on compile as errors." FALSE)
wish_werror(${MY_PROJECT_WERROR})
```

wish_alternative_linker
```
wish_alternative_linker(<string>)
Expand Down
2 changes: 1 addition & 1 deletion cmake/wish/wish_configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ macro(wish_configurations)

foreach (build_type IN LISTS arg_UNPARSED_ARGUMENTS arg_DEFAULT)
string(TOLOWER ${build_type} build_type_lower)
string(TOUPPER ${build_type} build_type_upper)
if (CMAKE_BUILD_TYPE STREQUAL build_type_lower)
string(TOUPPER ${build_type} build_type_upper)
set(WISH_BUILD_TYPE_IS_${build_type_lower} TRUE)
set(WISH_BUILD_TYPE_IS_${build_type_upper} TRUE)
else ()
Expand Down
14 changes: 14 additions & 0 deletions cmake/wish/wish_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,17 @@ macro(wish_optimization_flags)
endmacro()

# -------------------------------------------------------------------------------------------------

function(wish_werror enable)
# It seams like there is an issue with CMAKE_COMPILE_WARNING_AS_ERROR, use the flags for now
# set(CMAKE_COMPILE_WARNING_AS_ERROR ${enable})
if (enable)
wish_compiler_flags(
MSVC /Wx
Clang -Werror
GNU -Werror
)
endif ()
endfunction()

# -------------------------------------------------------------------------------------------------
2 changes: 2 additions & 0 deletions sandbox/versions/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ int main(int argc, char** argv) {

wish::change_current_path(argc, argv);

int i = 0;

foo();
std::cout << "argv[0]: " << argv[0] << std::endl;
std::cout << "version_number: " << build.version_number << std::endl;
Expand Down

0 comments on commit cfcd28a

Please sign in to comment.