Skip to content

Commit

Permalink
Migrate warnings as error queries outside of create_omr_compiler_library
Browse files Browse the repository at this point in the history
Downstream projects may want to override warnings as errors for compiler
libraries. Specifically, when compiling NASM sources on Windows Cygwin
we want to avoid adding the warnings as error options via the
`target_compile_options` API because NASM on Cygwin does not accept the
`/WX` flag which Visual Studio wants to apply. In such cases the
assembly sources are separated into their own compiler library and
warnings as errors are disabled before creating the library such that
the aforementioned flag is not applied.
  • Loading branch information
fjeremic committed Jun 7, 2021
1 parent 3cbc835 commit 31bfe55
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
9 changes: 0 additions & 9 deletions cmake/modules/OmrCompilerSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,6 @@ function(create_omr_compiler_library)
)

omr_inject_object_modification_targets(COMPILER_OBJECTS ${COMPILER_NAME} ${COMPILER_OBJECTS})

# warnings as errors and enhanced warnings currently don't work
if(OMR_ARCH_X86)
set(OMR_WARNINGS_AS_ERRORS ON)
set(OMR_ENHANCED_WARNINGS OFF)
else()
set(OMR_WARNINGS_AS_ERRORS OFF)
set(OMR_ENHANCED_WARNINGS OFF)
endif()

set(output_name_args "")
if(COMPILER_OUTPUT_NAME)
Expand Down
8 changes: 8 additions & 0 deletions fvtest/compilertest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ elseif(OMR_ARCH_S390)
)
endif()

if(OMR_ARCH_X86)
set(OMR_WARNINGS_AS_ERRORS ON)
set(OMR_ENHANCED_WARNINGS OFF)
else()
set(OMR_WARNINGS_AS_ERRORS OFF)
set(OMR_ENHANCED_WARNINGS OFF)
endif()

create_omr_compiler_library(
NAME testcompiler
OBJECTS ${COMPILERTEST_FILES}
Expand Down
8 changes: 8 additions & 0 deletions jitbuilder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ list(APPEND JITBUILDER_OBJECTS
${JITBUILDER_API_SOURCES}
)

if(OMR_ARCH_X86)
set(OMR_WARNINGS_AS_ERRORS ON)
set(OMR_ENHANCED_WARNINGS OFF)
else()
set(OMR_WARNINGS_AS_ERRORS OFF)
set(OMR_ENHANCED_WARNINGS OFF)
endif()

# Create jitbuilder library.
create_omr_compiler_library(
NAME jitbuilder
Expand Down

0 comments on commit 31bfe55

Please sign in to comment.