Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: refactor
check_prototype_definition
Introduce `check_prototype_definition_safe` that is safe for `Werror` usage.
- Loading branch information
Showing
3 changed files
with
21 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include(CheckPrototypeDefinition) | ||
|
||
function(check_prototype_definition_safe function prototype return header variable) | ||
# temporarily save CMAKE_C_FLAGS and disable warnings about unused | ||
# unused functions and parameters, otherwise they will always fail | ||
# if ENABLE_WERROR is on | ||
set(SAVED_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||
|
||
disable_warnings(unused-function) | ||
disable_warnings(unused-parameter) | ||
|
||
check_prototype_definition("${function}" "${prototype}" "${return}" "${header}" "${variable}") | ||
|
||
# restore CMAKE_C_FLAGS | ||
set(CMAKE_C_FLAGS "${SAVED_CMAKE_C_FLAGS}") | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters