Commit 9e0416cf authored by Ghislain MARY's avatar Ghislain MARY

Do not define CMake build flags by build type (this causes issues with configuration checking).

parent d490f9a8
......@@ -58,7 +58,6 @@ else()
endif()
if(ENABLE_ASM)
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
set(ARCH_OPTIONS "")
if(CMAKE_OSX_ARCHITECTURES)
set(ARCH_OPTIONS "${ARCH_OPTIONS} -arch ${CMAKE_OSX_ARCHITECTURES}")
......@@ -66,7 +65,7 @@ if(ENABLE_ASM)
if(CMAKE_OSX_SYSROOT)
set(ARCH_OPTIONS "${ARCH_OPTIONS} -isysroot ${CMAKE_OSX_SYSROOT}")
endif()
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${ARCH_OPTIONS} ${CMAKE_C_FLAGS_${UPPER_BUILD_TYPE}} -o <OBJECT> -c <SOURCE>")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${ARCH_OPTIONS} ${CMAKE_C_FLAGS} -o <OBJECT> -c <SOURCE>")
enable_language(ASM)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
#No optimization available yet for arm64
......
......@@ -241,14 +241,6 @@ endmacro()
macro(linphone_builder_apply_flags)
set(BUILD_TYPES "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
list(FIND BUILD_TYPES "${CMAKE_BUILD_TYPE}" BUILD_TYPE_FOUND)
set(BUILD_TYPE_SUFFIX "")
if(NOT ${BUILD_TYPE_FOUND} EQUAL -1)
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
set(BUILD_TYPE_SUFFIX "_${UPPER_BUILD_TYPE}")
endif()
if(LINPHONE_BUILDER_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES ${LINPHONE_BUILDER_OSX_ARCHITECTURES})
set(AUTOTOOLS_ARCH "-arch ${CMAKE_OSX_ARCHITECTURES}")
......@@ -259,27 +251,27 @@ macro(linphone_builder_apply_flags)
endif()
if(LINPHONE_BUILDER_CPPFLAGS)
set(CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_CPPFLAGS}")
set(CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_CPPFLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LINPHONE_BUILDER_CPPFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LINPHONE_BUILDER_CPPFLAGS}")
set(AUTOTOOLS_C_FLAGS "${AUTOTOOLS_C_FLAGS} ${LINPHONE_BUILDER_CPPFLAGS}")
set(AUTOTOOLS_CXX_FLAGS "${AUTOTOOLS_CXX_FLAGS} ${LINPHONE_BUILDER_CPPFLAGS}")
endif()
if(LINPHONE_BUILDER_CFLAGS)
set(CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_CFLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LINPHONE_BUILDER_CFLAGS}")
set(AUTOTOOLS_C_FLAGS "${AUTOTOOLS_C_FLAGS} ${LINPHONE_BUILDER_CFLAGS}")
endif()
if(LINPHONE_BUILDER_CXXFLAGS)
set(CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_CXXFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LINPHONE_BUILDER_CXXFLAGS}")
set(AUTOTOOLS_CXX_FLAGS "{AUTOTOOLS_CXX_FLAGS} ${LINPHONE_BUILDER_CXX_FLAGS}")
endif()
if(LINPHONE_BUILDER_OBJCFLAGS)
set(CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_OBJCFLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LINPHONE_BUILDER_OBJCFLAGS}")
set(AUTOTOOLS_OBJC_FLAGS "${AUTOTOOLS_OBJC_FLAGS} ${LINPHONE_BUILDER_OBJCFLAGS}")
endif()
if(LINPHONE_BUILDER_LDFLAGS)
set(CMAKE_EXE_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_EXE_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_MODULE_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_SHARED_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINPHONE_BUILDER_LDFLAGS}")
set(AUTOTOOLS_LINKER_FLAGS "${AUTOTOOLS_LINKER_FLAGS} ${LINPHONE_BUILDER_LDFLAGS}")
endif()
endmacro()
......@@ -306,23 +298,16 @@ macro(linphone_builder_apply_extra_flags PROJNAME)
set(ep_objcflags "${ep_objcflags} ${EP_${PROJNAME}_EXTRA_OBJCFLAGS}")
set(ep_ldflags "${ep_ldflags} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
else()
set(BUILD_TYPES "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
list(FIND BUILD_TYPES "${CMAKE_BUILD_TYPE}" BUILD_TYPE_FOUND)
set(BUILD_TYPE_SUFFIX "")
if(NOT ${BUILD_TYPE_FOUND} EQUAL -1)
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
set(BUILD_TYPE_SUFFIX "_${UPPER_BUILD_TYPE}")
endif()
if(EP_${PROJNAME}_EXTRA_CFLAGS)
set(CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_CFLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EP_${PROJNAME}_EXTRA_CFLAGS}")
endif()
if(EP_${PROJNAME}_EXTRA_CXXFLAGS)
set(CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_CXXFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EP_${PROJNAME}_EXTRA_CXXFLAGS}")
endif()
if(EP_${PROJNAME}_EXTRA_LDFLAGS)
set(CMAKE_EXE_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_EXE_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_MODULE_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_SHARED_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
endif()
endif()
endmacro()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment