Commit b905819b authored by Ghislain MARY's avatar Ghislain MARY

Fix extra flags passing to external projects.

parent 32e522f7
......@@ -340,6 +340,7 @@ endmacro()
macro(linphone_builder_apply_flags)
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if(LINPHONE_BUILDER_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES ${LINPHONE_BUILDER_OSX_ARCHITECTURES})
set(AUTOTOOLS_ARCH "-arch ${CMAKE_OSX_ARCHITECTURES}")
......@@ -350,29 +351,30 @@ macro(linphone_builder_apply_flags)
endif()
if(LINPHONE_BUILDER_CPPFLAGS)
set(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_CPPFLAGS}")
set(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_CPPFLAGS}")
set(CMAKE_C_FLAGS_${BUILD_TYPE} "${CMAKE_C_FLAGS_${BUILD_TYPE}} ${LINPHONE_BUILDER_CPPFLAGS}")
set(CMAKE_CXX_FLAGS_${BUILD_TYPE} "${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${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_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_CFLAGS}")
set(CMAKE_C_FLAGS_${BUILD_TYPE} "${CMAKE_C_FLAGS_${BUILD_TYPE}} ${LINPHONE_BUILDER_CFLAGS}")
set(AUTOTOOLS_C_FLAGS "${AUTOTOOLS_C_FLAGS} ${LINPHONE_BUILDER_CFLAGS}")
endif()
if(LINPHONE_BUILDER_CXXFLAGS)
set(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_${BUILD_TYPE} "${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${LINPHONE_BUILDER_CXXFLAGS}")
set(AUTOTOOLS_CXX_FLAGS "{AUTOTOOLS_CXX_FLAGS} ${LINPHONE_BUILDER_CXX_FLAGS}")
endif()
if(LINPHONE_BUILDER_OBJCFLAGS)
set(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_OBJCFLAGS}")
set(CMAKE_C_FLAGS_${BUILD_TYPE} "${CMAKE_C_FLAGS_${BUILD_TYPE}} ${LINPHONE_BUILDER_OBJCFLAGS}")
set(AUTOTOOLS_OBJC_FLAGS "${AUTOTOOLS_OBJC_FLAGS} ${LINPHONE_BUILDER_OBJCFLAGS}")
endif()
if(LINPHONE_BUILDER_LDFLAGS)
set(CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE} "${CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_${BUILD_TYPE} "${CMAKE_MODULE_LINKER_FLAGS_${BUILD_TYPE}} ${LINPHONE_BUILDER_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE} "${CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE}} ${LINPHONE_BUILDER_LDFLAGS}")
set(AUTOTOOLS_LINKER_FLAGS "${AUTOTOOLS_LINKER_FLAGS} ${LINPHONE_BUILDER_LDFLAGS}")
endif()
unset(BUILD_TYPE)
endmacro()
......@@ -389,12 +391,12 @@ endmacro()
macro(linphone_builder_apply_extra_flags PROJNAME)
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if(MSVC)
set(_no_warnings_flag "/W0")
else()
set(_no_warnings_flag "-w")
endif()
if(EP_${PROJNAME}_BUILD_METHOD STREQUAL "autotools")
set(ep_asflags "${ep_asflags} ${EP_${PROJNAME}_EXTRA_ASFLAGS}")
set(ep_cppflags "${ep_cppflags} ${EP_${PROJNAME}_EXTRA_CPPFLAGS}")
......@@ -406,36 +408,39 @@ macro(linphone_builder_apply_extra_flags PROJNAME)
set(ep_cppflags "${ep_cppflags} ${_no_warnings_flag}")
endif()
else()
set(SAVED_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(SAVED_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(SAVED_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
set(SAVED_CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
set(SAVED_CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(SAVED_CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${BUILD_TYPE}}")
set(SAVED_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${BUILD_TYPE}}")
set(SAVED_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE}}")
set(SAVED_CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_${BUILD_TYPE}}")
set(SAVED_CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE}}")
if(EP_${PROJNAME}_EXTRA_CFLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EP_${PROJNAME}_EXTRA_CFLAGS}")
set(CMAKE_C_FLAGS_${BUILD_TYPE} "${CMAKE_C_FLAGS_${BUILD_TYPE}} ${EP_${PROJNAME}_EXTRA_CFLAGS}")
endif()
if(EP_${PROJNAME}_EXTRA_CXXFLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EP_${PROJNAME}_EXTRA_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_${BUILD_TYPE} "${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${EP_${PROJNAME}_EXTRA_CXXFLAGS}")
endif()
if(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}")
set(CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE} "${CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_${BUILD_TYPE} "${CMAKE_MODULE_LINKER_FLAGS_${BUILD_TYPE}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE} "${CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
endif()
if(EP_${PROJNAME}_IGNORE_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_no_warnings_flag}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_no_warnings_flag}")
set(CMAKE_C_FLAGS_${BUILD_TYPE} "${CMAKE_C_FLAGS_${BUILD_TYPE}} ${_no_warnings_flag}")
set(CMAKE_CXX_FLAGS_${BUILD_TYPE} "${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${_no_warnings_flag}")
endif()
endif()
unset(BUILD_TYPE)
endmacro()
macro(linphone_builder_restore_flags)
set(CMAKE_C_FLAGS "${SAVED_CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${SAVED_CMAKE_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${SAVED_CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${SAVED_CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${SAVED_CMAKE_SHARED_LINKER_FLAGS}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
set(CMAKE_C_FLAGS_${BUILD_TYPE} "${SAVED_CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_${BUILD_TYPE} "${SAVED_CMAKE_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE} "${SAVED_CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_${BUILD_TYPE} "${SAVED_CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE} "${SAVED_CMAKE_SHARED_LINKER_FLAGS}")
unset(BUILD_TYPE)
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