diff --git a/cmake/compilerCheck.cmake b/cmake/compilerCheck.cmake index 62308d674..1167a5cbc 100644 --- a/cmake/compilerCheck.cmake +++ b/cmake/compilerCheck.cmake @@ -1,4 +1,4 @@ -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) message(ERROR "GCC >= 4.8 required - detected ${CMAKE_CXX_COMPILER_VERSION} not supported") endif () diff --git a/cmake/compilerDefinitions.cmake b/cmake/compilerDefinitions.cmake index e7117fc0e..31fe87859 100644 --- a/cmake/compilerDefinitions.cmake +++ b/cmake/compilerDefinitions.cmake @@ -1,6 +1,6 @@ if (MSVC) # Visual Studio only sets _DEBUG - if (CMAKE_BUILD_TYPE MATCHES "Debug") + if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DDEBUG) endif() @@ -15,7 +15,7 @@ endif() # TODO: this should probably apply to the compiler and not the platform if (CPPCHK_GLIBCXX_DEBUG AND UNIX) # TODO: check if this can be enabled again for Clang - also done in Makefile - if (CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) add_definitions(-D_GLIBCXX_DEBUG) endif() endif() diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 6236e8261..3008e20ff 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -20,8 +20,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Weverything) endif() -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if(CMAKE_BUILD_TYPE MATCHES "Release") +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if(CMAKE_BUILD_TYPE STREQUAL "Release") # "Release" uses -O3 by default add_compile_options(-O2) endif() @@ -45,14 +45,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" add_compile_options(-Wno-multichar) endif() -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") add_compile_options(-Woverloaded-virtual) # when a function declaration hides virtual functions from a base class add_compile_options(-Wno-maybe-uninitialized) # there are some false positives add_compile_options(-Wsuggest-attribute=noreturn) add_compile_options(-Wno-shadow) # whenever a local variable or type declaration shadows another one elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14) - if (CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") # work around performance regression - see https://github.com/llvm/llvm-project/issues/53555 add_compile_options(-mllvm -inline-deferral) endif() @@ -124,7 +124,7 @@ if (MSVC) # No Whole Program Optimization # C/C++ - Optimization - if(CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") add_compile_options(/O2) # Optimization - Maximum Optimization (Favor Speed) add_compile_options(/Ob2) # Inline Function Expansion - Any Suitable add_compile_options(/Oi) # Enable Intrinsic Functions @@ -135,7 +135,7 @@ if (MSVC) endif() # C/C++ - Code Generation - if(CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") add_compile_options(/GF) # Enable String Pooling add_compile_options(/MD) # Runtime Library - Multi-threaded DLL add_compile_options(/GS-) # Disable Security Check @@ -172,7 +172,7 @@ if (MSVC) add_compile_options(/Zc:throwingNew /Zc:__cplusplus) # Additional Options # Linker - General - if(CMAKE_BUILD_TYPE MATCHES "Debug") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_link_options(/INCREMENTAL) # Enable Incremental Linking - Yes endif() add_link_options(/NOLOGO) # SUppress Startup Banner - Yes @@ -191,13 +191,13 @@ if (MSVC) add_link_options(/OPT:ICF) # Enable COMDAT Folding - Yes # Linker - Advanced - if(CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") add_link_options(/RELEASE) # Set Checksum - Yes endif() endif() # TODO: check if this can be enabled again - also done in Makefile -if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND +if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-U_GLIBCXX_DEBUG) diff --git a/cmake/cxx11.cmake b/cmake/cxx11.cmake index 176214ab1..b4692a7e1 100644 --- a/cmake/cxx11.cmake +++ b/cmake/cxx11.cmake @@ -1,6 +1,6 @@ macro(use_cxx11) if (CMAKE_VERSION VERSION_LESS "3.1") - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") diff --git a/cmake/options.cmake b/cmake/options.cmake index 83dc75050..90c94a0d4 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -21,8 +21,8 @@ option(WARNINGS_ARE_ERRORS "Treat warnings as errors" set(USE_MATCHCOMPILER "Auto" CACHE STRING "Usage of match compiler") set_property(CACHE USE_MATCHCOMPILER PROPERTY STRINGS Auto Off On Verify) -if (USE_MATCHCOMPILER MATCHES "Auto") - if (NOT CMAKE_BUILD_TYPE MATCHES "Debug") +if (USE_MATCHCOMPILER STREQUAL "Auto") + if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") set(USE_MATCHCOMPILER_OPT "On") else() set(USE_MATCHCOMPILER_OPT "Off") diff --git a/cmake/printInfo.cmake b/cmake/printInfo.cmake index 85a955016..5aada969a 100644 --- a/cmake/printInfo.cmake +++ b/cmake/printInfo.cmake @@ -53,7 +53,7 @@ endif() message( STATUS ) message( STATUS "USE_THREADS = ${USE_THREADS}" ) message( STATUS "CMAKE_THREAD_LIBS_INIT = ${CMAKE_THREAD_LIBS_INIT}" ) -if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off") +if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off") message( STATUS ) message( STATUS "PYTHON_VERSION_STRING = ${PYTHON_VERSION_STRING}" ) message( STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) diff --git a/externals/tinyxml2/CMakeLists.txt b/externals/tinyxml2/CMakeLists.txt index 3488143d8..e2aced089 100644 --- a/externals/tinyxml2/CMakeLists.txt +++ b/externals/tinyxml2/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB srcs "*.cpp") add_library(tinyxml2_objs OBJECT ${srcs} ${hdrs}) # TODO: needs to be fixed upstream -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(tinyxml2_objs PRIVATE -Wno-suggest-attribute=format) endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index f718e7673..d8c885de0 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -1,6 +1,6 @@ if (BUILD_GUI) - if (CMAKE_BUILD_TYPE MATCHES "Release") + if (CMAKE_BUILD_TYPE STREQUAL "Release") add_definitions(-DQT_NO_DEBUG) add_definitions(-DQT_NO_DEBUG_OUTPUT) add_definitions(-DQT_NO_WARNING_OUTPUT) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 360844298..44af140e9 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -5,7 +5,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 MATCHES "Verify") + if (USE_MATCHCOMPILER STREQUAL "Verify") set(verify_option "--verify") endif() add_custom_command( @@ -26,7 +26,7 @@ foreach(file ${srcs}) build_src(srcs_build ${file}) endforeach() -if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off") +if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off") set(srcs_lib ${srcs_build}) else() set(srcs_lib ${srcs}) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e6151e96f..cbf3f8bcc 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,6 +1,6 @@ set(srcs_lib pathmatch.cpp path.cpp) foreach(file ${srcs_lib}) - if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off") + if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off") set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}") set_source_files_properties(${src} PROPERTIES GENERATED TRUE) else() diff --git a/tools/triage/CMakeLists.txt b/tools/triage/CMakeLists.txt index 32be7cf4d..78601f608 100644 --- a/tools/triage/CMakeLists.txt +++ b/tools/triage/CMakeLists.txt @@ -1,5 +1,5 @@ if (BUILD_GUI AND BUILD_TESTS) - if (CMAKE_BUILD_TYPE MATCHES "Release") + if (CMAKE_BUILD_TYPE STREQUAL "Release") add_definitions(-DQT_NO_DEBUG) add_definitions(-DQT_NO_DEBUG_OUTPUT) add_definitions(-DQT_NO_WARNING_OUTPUT)