From 7b37a877f66f94980a819aa585614fb2a9af2e9a Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Wed, 25 Aug 2021 11:14:46 +0200 Subject: [PATCH] factorize findns3.cmake Still keeps a list of know/supported versions hardcoded. Inspired from FindBoost.cmake. --- tools/cmake/Modules/FindNS3.cmake | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/tools/cmake/Modules/FindNS3.cmake b/tools/cmake/Modules/FindNS3.cmake index 71d1b32d08..905f921dee 100644 --- a/tools/cmake/Modules/FindNS3.cmake +++ b/tools/cmake/Modules/FindNS3.cmake @@ -19,27 +19,16 @@ set(SIMGRID_HAVE_NS3 0) set(NS3_HINT ${ns3_path} CACHE PATH "Path to search for NS3 lib and include") +set(NS3_KNOWN_VERSIONS "3.22" "3.23" "3.24" "3.25" "3.26" "3.27" "3.28" "3.29" "3.30" "3.31" "3.32" "3.33" "3.34" "3.35" "3.36" "3.37" "3.38" "3.39" "3.40") + +foreach (_ns3_ver ${NS3_KNOWN_VERSIONS}) + list(APPEND _ns3_LIB_SEARCH_DIRS "ns${_ns3_ver}-core" "nss${_ns3_ver}-core-optimized" "nss${_ns3_ver}-core-debug") + list(APPEND _ns3_INCLUDE_SEARCH_DIRS "include/ns${_ns3_ver}") +endforeach() + find_library(NS3_LIBRARIES NAME ns3-core - ns3.22-core ns3.22-core-optimized ns3.22-core-debug - ns3.23-core ns3.23-core-optimized ns3.23-core-debug - ns3.24-core ns3.24-core-optimized ns3.24-core-debug - ns3.25-core ns3.25-core-optimized ns3.25-core-debug - ns3.26-core ns3.26-core-optimized ns3.26-core-debug - ns3.27-core ns3.27-core-optimized ns3.27-core-debug - ns3.28-core ns3.28-core-optimized ns3.28-core-debug - ns3.29-core ns3.29-core-optimized ns3.29-core-debug - ns3.30-core ns3.30-core-optimized ns3.30-core-debug - ns3.31-core ns3.31-core-optimized ns3.31-core-debug - ns3.32-core ns3.32-core-optimized ns3.32-core-debug - ns3.33-core ns3.33-core-optimized ns3.33-core-debug - ns3.34-core ns3.34-core-optimized ns3.34-core-debug - ns3.35-core ns3.35-core-optimized ns3.35-core-debug - ns3.36-core ns3.36-core-optimized ns3.36-core-debug - ns3.37-core ns3.37-core-optimized ns3.37-core-debug - ns3.38-core ns3.38-core-optimized ns3.38-core-debug - ns3.39-core ns3.39-core-optimized ns3.39-core-debug - ns3.40-core ns3.40-core-optimized ns3.40-core-debug + ${_ns3_LIB_SEARCH_DIRS} PATH_SUFFIXES lib64 lib ns3/lib PATHS ${NS3_HINT} @@ -48,8 +37,7 @@ find_library(NS3_LIBRARIES find_path(NS3_INCLUDE_DIR NAME ns3/core-module.h PATH_SUFFIXES include ns3/include - include/ns3.22 include/ns3.23 include/ns3.24 include/ns3.25 include/ns3.26 include/ns3.27 include/ns3.28 include/ns3.29 include/ns3.30 - include/ns3.31 include/ns3.32 include/ns3.33 include/ns3.34 include/ns3.35 include/ns3.36 include/ns3.37 include/ns3.38 include/ns3.39 include/ns3.40 + ${_ns3_INCLUDE_SEARCH_DIRS} PATHS ${NS3_HINT} ) -- 2.20.1