summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake
blob: c3f65263a664692d7a0192239c8c3c67a18f4e34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
enable_language(${LANGUAGE})

include(WarningAsErrorOptions.cmake)
get_warning_options(warning_options ${LANGUAGE})

if (DEFINED warning_options)
  add_executable(WerrorOn warn.${EXTENSION})
  target_compile_options(WerrorOn PUBLIC "${warning_options}")
  set_target_properties(WerrorOn PROPERTIES COMPILE_WARNING_AS_ERROR ON)
else()
  # if no werror option is set for the environment, use err so that build fails as expected
  add_executable(WerrorOn err.${EXTENSION})
endif()