Suggestion for cmake/compiler-specific.cmake - allow user to override CFLAGS/LDFLAGS:

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")

  if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
    target_compile_definitions(common INTERFACE CC_GCC_LIKE_ASM)

    if(NOT DEFINED ENV{CFLAGS})
      target_compile_options(
        common INTERFACE -O0
                         # <$<$<BOOL:${PROFILE}>:-pg>
      )

      target_compile_options(
        common
        INTERFACE -Wall -funroll-loops -Wcast-align
                  -Werror=implicit-function-declaration -Werror=implicit-int
      )

      # If GCC version is greater than 4.2.0, enable the following flags
      if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.2.0)
        target_compile_options(
          common INTERFACE -m64 -minline-all-stringops -falign-loops
                           -ftree-vectorize -fno-strict-overflow -mtune=generic
        )
      endif()
    endif()
  elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
    target_compile_definitions(common INTERFACE CC_GCC_LIKE_ASM)
    if(NOT DEFINED ENV{CFLAGS})
      target_compile_options(common INTERFACE -m64)
    endif()
    if(NOT DEFINED ENV{LDFLAGS})
      target_link_options(common INTERFACE -m64)
    endif()
  endif()

# etc etc


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/4082/2557930510@github.com>