Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #12666 - got rid of ill-conceived USE_MATCHCOMPILER CMake option validation (#6348) #6377

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@ option(WARNINGS_ARE_ERRORS "Treat warnings as errors"
option(EXTERNALS_AS_SYSTEM "Treat externals as system includes" OFF)

set(USE_MATCHCOMPILER "Auto" CACHE STRING "Usage of match compiler")
set(_MATCHCOMPILER_STRINGS Auto Off On Verify)
set_property(CACHE USE_MATCHCOMPILER PROPERTY STRINGS ${_MATCHCOMPILER_STRINGS})
if (NOT ${USE_MATCHCOMPILER} IN_LIST _MATCHCOMPILER_STRINGS)
message(FATAL_ERROR "Invalid USE_MATCHCOMPILER value '${USE_MATCHCOMPILER}'")
endif()
if (USE_MATCHCOMPILER STREQUAL "Auto")
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(USE_MATCHCOMPILER_OPT "On")
set_property(CACHE USE_MATCHCOMPILER PROPERTY STRINGS Auto Off On Verify)
if(USE_MATCHCOMPILER)
if(USE_MATCHCOMPILER STREQUAL "Auto")
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Non-debug build detected - enabling matchcompiler")
set(USE_MATCHCOMPILER_OPT "On")
else()
message(STATUS "Debug build detected - disabling matchcompiler")
set(USE_MATCHCOMPILER_OPT "Off")
endif()
elseif(USE_MATCHCOMPILER STREQUAL "Verify")
set(USE_MATCHCOMPILER_OPT "Verify")
else()
set(USE_MATCHCOMPILER_OPT "Off")
set(USE_MATCHCOMPILER_OPT "On")
endif()
else()
set(USE_MATCHCOMPILER_OPT ${USE_MATCHCOMPILER})
set(USE_MATCHCOMPILER_OPT "Off")
endif()

option(BUILD_CORE_DLL "Build lib as cppcheck-core.dll with Visual Studio" OFF)
Expand Down
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function(build_src output filename)
get_filename_component(file ${filename} NAME)
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/build/mc_${file})
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
if (USE_MATCHCOMPILER STREQUAL "Verify")
if (USE_MATCHCOMPILER_OPT STREQUAL "Verify")
set(verify_option "--verify")
endif()
add_custom_command(
Expand Down
Loading