Abstract into common version and parameterize

This commit is contained in:
Roland Kaufmann 2013-03-15 09:39:38 +01:00
parent 3d252ae8f4
commit ce007fca7d
2 changed files with 8 additions and 15 deletions

View File

@ -22,23 +22,16 @@ endmacro (remove_duplicate_libraries module)
# headers can be trimmed from the end, since adding a directory to
# the list is an idempotent action
macro (remove_duplicate_headers module)
if (DEFINED ${module}_INCLUDE_DIRS)
list (REMOVE_DUPLICATES ${module}_INCLUDE_DIRS)
endif (DEFINED ${module}_INCLUDE_DIRS)
endmacro (remove_duplicate_headers module)
# linker flags may not be specified at all
macro (remove_duplicate_flags module)
if (DEFINED ${module}_LINKER_FLAGS)
list (REMOVE_DUPLICATES ${module}_LINKER_FLAGS)
endif (DEFINED ${module}_LINKER_FLAGS)
endmacro (remove_duplicate_flags module)
macro (remove_duplicate_var module suffix)
if (DEFINED ${module}_${suffix})
list (REMOVE_DUPLICATES ${module}_${suffix})
endif (DEFINED ${module}_${suffix})
endmacro (remove_duplicate_var module suffix)
# fix up both headers and libraries, in case two dependencies have
# included the same second-level library independently
macro (remove_dup_deps module)
remove_duplicate_headers (${module})
remove_duplicate_var (${module} INCLUDE_DIRS)
remove_duplicate_var (${module} LINKER_FLAGS)
remove_duplicate_libraries (${module})
remove_duplicate_flags (${module})
endmacro (remove_dup_deps module)

View File

@ -101,7 +101,7 @@ macro (find_and_append_package_to prefix name)
if ("${var}" STREQUAL "LIBRARIES")
remove_duplicate_libraries (${prefix})
else ("${var}" STREQUAL "LIBRARIES")
list (REMOVE_DUPLICATES ${prefix}_${var})
remove_duplicate_var (${prefix} ${var})
endif ("${var}" STREQUAL "LIBRARIES")
endforeach (var)
# some libraries only define xxx_FOUND and not a corresponding HAVE_xxx