Commit 5c6b9905 authored by Ghislain MARY's avatar Ghislain MARY

Handle detection of conflicting CMake options for grouped builders.

parent 4d8d7095
......@@ -617,6 +617,35 @@ function(linphone_builder_add_external_projects)
endforeach()
endfunction()
macro(detect_conflicting_cmake_options)
list(REMOVE_DUPLICATES EP_linphone_builder_CMAKE_OPTIONS)
set(_new_options )
foreach(_option ${EP_linphone_builder_CMAKE_OPTIONS})
string(REGEX MATCH "^-D(.+)=(.*)$" _match "${_option}")
if(_match)
set(_new_option "-D${CMAKE_MATCH_1}=")
if(CMAKE_MATCH_2)
set(_new_option "${_new_option}ON")
set(_conflicting_option "${_new_option}OFF")
else()
set(_new_option "${_new_option}OFF")
set(_conflicting_option "${_new_option}ON")
endif()
list(FIND _new_options "${_new_option}" _found)
list(FIND _new_options "${_conflicting_option}" _conflict_found)
if(_found EQUAL -1)
list(APPEND _new_options "${_new_option}")
endif()
if(_conflict_found GREATER -1)
message(FATAL_ERROR "Conflicting options ${_new_option} and ${_conflicting_option}")
endif()
endif()
endforeach()
if(_new_options)
set(EP_linphone_builder_CMAKE_OPTIONS ${_new_options})
endif()
endmacro()
function(linphone_builder_add_grouped_external_source_path_projects)
set(_grouped_builders)
if(LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS)
......@@ -646,8 +675,7 @@ function(linphone_builder_add_grouped_external_source_path_projects)
else()
set(EP_linphone_builder_LINKING_TYPE ${EP_linphone_builder_LINKING_TYPES})
endif()
list(REMOVE_DUPLICATES EP_linphone_builder_CMAKE_OPTIONS)
# TODO: Check for conflicting CMAKE_OPTIONS
detect_conflicting_cmake_options()
list(REMOVE_DUPLICATES EP_linphone_builder_EXTRA_LDFLAGS)
list(REMOVE_DUPLICATES EP_linphone_builder_DEPENDENCIES)
list(APPEND EP_linphone_builder_CMAKE_OPTIONS ${EP_linphone_builder_ADDITIONAL_CMAKE_OPTIONS})
......
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