build: Add NS3_FORCE_LOCAL_DEPENDENCIES option to ignore system directories

This commit is contained in:
Gabriel Ferreira
2024-06-11 17:55:23 +02:00
parent 55abe1f10a
commit b98b408f72
4 changed files with 20 additions and 0 deletions

View File

@@ -60,6 +60,11 @@ option(NS3_FAST_LINKERS "Use Mold or LLD to speed up linking if available" ON)
option(NS3_FETCH_OPTIONAL_COMPONENTS
"Fetch Brite, Click and Openflow dependencies" OFF
)
option(
NS3_FORCE_LOCAL_DEPENDENCIES
"Only search applications, headers, libraries on explicitly set directories"
OFF
)
option(NS3_GSL "Build with GSL support" ON)
option(NS3_GTK3 "Build with GTK3 support" ON)
option(NS3_LINK_TIME_OPTIMIZATION "Build with link-time optimization" OFF)

View File

@@ -1,4 +1,5 @@
disable_cmake_warnings()
string(REPLACE ";" "/bin;" syspaths "${CMAKE_SYSTEM_PREFIX_PATH};")
set(3RD_PARTY_FIND_PROGRAM_HINTS
# find_program HINTS for Doxygen
# https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindDoxygen.cmake
@@ -18,5 +19,6 @@ set(3RD_PARTY_FIND_PROGRAM_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin"
/Applications/Graphviz.app/Contents/MacOS
/Applications/Utilities/Graphviz.app/Contents/MacOS
${syspaths}
)
enable_cmake_warnings()

View File

@@ -111,6 +111,9 @@ function(find_external_library)
# directories
$ENV{PATH} # Search for libraries in PATH directories
)
if(library_search_paths)
list(REMOVE_DUPLICATES library_search_paths)
endif()
enable_cmake_warnings()
# cmake-format: off
#
@@ -223,6 +226,9 @@ function(find_external_library)
# ns-3-dev/build
${CMAKE_INSTALL_PREFIX} # Search for headers in the install
)
if(header_search_paths)
list(REMOVE_DUPLICATES header_search_paths)
endif()
set(not_found_headers)
set(include_dirs)

View File

@@ -221,6 +221,13 @@ macro(process_options)
unset(CMAKE_VERBOSE_MAKEFILE CACHE)
endif()
if(${NS3_FORCE_LOCAL_DEPENDENCIES})
set(CMAKE_FIND_FRAMEWORK NEVER)
set(CMAKE_FIND_APPBUNDLE NEVER)
set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE)
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE)
endif()
# Set warning level and warning as errors
if(${NS3_WARNINGS})
if(DEFINED MSVC)