build, docs: fixes find_external_library header search paths and docs

Includes:
- search for headers in the library directory when using find_external_library
- prevent module processing (brite, click and openflow) from continuing if ${dependency_name}_FOUND is not set
This commit is contained in:
Gabriel Ferreira
2022-03-25 22:31:56 -03:00
parent 9beeff24f3
commit cbb7628473
5 changed files with 25 additions and 14 deletions

View File

@@ -1305,8 +1305,7 @@ function(remove_lib_prefix prefixed_library library)
# If there is a lib prefix, try to remove it
if(${lib_pos} EQUAL 0)
# Check if we still have something remaining
# after removing the "lib" prefix
# Check if we still have something remaining after removing the "lib" prefix
string(LENGTH ${prefixed_library} len)
if(${len} LESS 4)
message(FATAL_ERROR "Invalid library name: ${prefixed_library}")
@@ -1821,7 +1820,7 @@ function(find_external_library)
foreach(libdir ${library_dirs})
get_filename_component(parent_libdir ${libdir} DIRECTORY)
get_filename_component(parent_parent_libdir ${parent_libdir} DIRECTORY)
list(APPEND parent_dirs ${parent_libdir} ${parent_parent_libdir})
list(APPEND parent_dirs ${libdir} ${parent_libdir} ${parent_parent_libdir})
endforeach()
# If we already found a library somewhere, limit the search paths for the

View File

@@ -814,7 +814,7 @@ Here is how it works:
foreach(libdir ${library_dirs})
get_filename_component(parent_libdir ${libdir} DIRECTORY)
get_filename_component(parent_parent_libdir ${parent_libdir} DIRECTORY)
list(APPEND parent_dirs ${parent_libdir} ${parent_parent_libdir})
list(APPEND parent_dirs ${libdir} ${parent_libdir} ${parent_parent_libdir})
endforeach()
# If we already found a library somewhere, limit the search paths for the header
@@ -986,10 +986,16 @@ example of ``find_external_library`` usage.
SEARCH_PATHS ${NS3_WITH_OPENFLOW} # user-settable search path, empty by default
)
# Check if header and library were found,
# and stop processing the module in case they were not
if(NOT
${openflow_FOUND}
# Before testing if the header and library were found ${openflow_FOUND},
# test if openflow_FOUND was defined
# If openflow_FOUND was not defined, the dependency name above doesn't match
# the tested values below
# If openflow_FOUND is set to FALSE, stop processing the module by returning
# to the parent directory with return()
if((NOT
openflow_FOUND)
AND (NOT
${openflow_FOUND})
)
message(STATUS "Openflow was not found")
return()

View File

@@ -16,8 +16,10 @@ find_external_library(
SEARCH_PATHS ${NS3_WITH_BRITE}
)
if(NOT
${brite_FOUND}
if((NOT
brite_FOUND)
OR (NOT
${brite_FOUND})
)
message(STATUS "Skipping src/brite")
return()

View File

@@ -17,8 +17,10 @@ find_external_library(
SEARCH_PATHS ${NS3_WITH_CLICK}
)
if(NOT
${click_FOUND}
if((NOT
click_FOUND)
AND (NOT
${click_FOUND})
)
message(STATUS "Skipping src/click")
return()

View File

@@ -16,8 +16,10 @@ find_external_library(
SEARCH_PATHS ${NS3_WITH_OPENFLOW}
)
if(NOT
${openflow_FOUND}
if((NOT
openflow_FOUND)
AND (NOT
${openflow_FOUND})
)
message(STATUS "Skipping src/openflow")
return()