[PATCH] D26579: [cmake] Allow CMAKE_BUILD_TYPE=Gentoo

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 08:28:52 PST 2016


rnk added a comment.

I'd be surprised if a custom CMAKE_BUILD_TYPE value was really the best way to get distro CFLAGS through third party CMake files. My understanding is that each project defines its own custom build types, so that developers can share common configurations (think release+asserts, -gline-tables-only with logic to opt into gold).

I think if the kitware people come and say that the intention is for well-written CMake files to be configuration agnostic, then we could add support for config=Gentoo. I'd also want to know what the best practices are to avoid iterating over the standard config types.  We currently do this kind of thing a lot:

  # On non-Debug builds cmake automatically defines NDEBUG, so we
  # explicitly undefine it:
  if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
    add_definitions( -UNDEBUG )
    # Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines.
    foreach (flags_var_to_scrub
        CMAKE_CXX_FLAGS_RELEASE
        CMAKE_CXX_FLAGS_RELWITHDEBINFO
        CMAKE_CXX_FLAGS_MINSIZEREL
        CMAKE_C_FLAGS_RELEASE
        CMAKE_C_FLAGS_RELWITHDEBINFO
        CMAKE_C_FLAGS_MINSIZEREL)
      string (REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " "
        "${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
    endforeach()
  endif()


https://reviews.llvm.org/D26579





More information about the llvm-commits mailing list