Skip to content

Commit

Permalink
build, core: remove code required for cmake versions < 3.12
Browse files Browse the repository at this point in the history
With the raise of the minimal CMake version, this is no longer needed.
  • Loading branch information
a-andre committed Oct 25, 2023
1 parent ecd3874 commit 41ba71b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 64 deletions.
34 changes: 1 addition & 33 deletions build-support/macros-and-definitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -529,18 +529,6 @@ macro(process_options)
if("${CLANG_TIDY}" STREQUAL "CLANG_TIDY-NOTFOUND")
message(FATAL_ERROR "Clang-tidy was not found")
else()
if((${CMAKE_VERSION} VERSION_LESS "3.12.0") AND ${NS3_CCACHE}
AND (NOT ("${CCACHE}" STREQUAL "CCACHE-NOTFOUND"))
)
# CMake <3.12 puts CMAKE_CXX_COMPILER_LAUNCHER in the incorrect place
# and CCache ends up being unable to cache anything if calling
# clang-tidy https://gitlab.kitware.com/cmake/cmake/-/issues/18266
message(
FATAL_ERROR
"The current CMake ${CMAKE_VERSION} won't ccache objects correctly when running with clang-tidy."
"Update CMake to at least version 3.12, or disable either ccache or clang-tidy to continue."
)
endif()
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY}")
endif()
else()
Expand Down Expand Up @@ -893,27 +881,7 @@ macro(process_options)
set(Python3_FOUND FALSE)
set(Python3_INCLUDE_DIRS)
if(${NS3_PYTHON_BINDINGS})
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0")
find_package(Python3 COMPONENTS Interpreter Development)
else()
# cmake-format: off
set(Python_ADDITIONAL_VERSIONS 3.6 3.7 3.8 3.9 3.10 3.11)
# cmake-format: on
find_package(PythonInterp)
find_package(PythonLibs)

# Move deprecated results into the FindPython3 resulting variables
set(Python3_Interpreter_FOUND ${PYTHONINTERP_FOUND})
set(Python3_Development_FOUND ${PYTHONLIBS_FOUND})
if(${PYTHONINTERP_FOUND})
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
set(Python3_FOUND TRUE)
endif()
if(${PYTHONLIBS_FOUND})
set(Python3_LIBRARIES ${PYTHON_LIBRARIES})
set(Python3_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
endif()
endif()
find_package(Python3 COMPONENTS Interpreter Development)
else()
# If Python was not set yet, use the version found by check_deps
check_deps("" "python3" python3_deps)
Expand Down
36 changes: 5 additions & 31 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,12 @@ if(${GSL_FOUND})
endif()

# Check for dependencies and add sources accordingly
if(${CMAKE_VERSION}
VERSION_LESS
"3.11.0"
check_include_files(
"boost/units/quantity.hpp;boost/units/systems/si.hpp"
HAVE_BOOST_UNITS
LANGUAGE
CXX
)
check_include_file_cxx(
boost/units/quantity.hpp
HAVE_BOOST_UNITS_QUANTITY
)
check_include_file_cxx(
boost/units/systems/si.hpp
HAVE_BOOST_UNITS_SI
)
if(${HAVE_BOOST_UNITS_QUANTITY}
AND ${HAVE_BOOST_UNITS_SI}
)
set(HAVE_BOOST_UNITS
TRUE
)
else()
set(HAVE_BOOST_UNITS
FALSE
)
endif()
else()
# Fast path for CMake >= 3.11
check_include_files(
"boost/units/quantity.hpp;boost/units/systems/si.hpp"
HAVE_BOOST_UNITS
LANGUAGE
CXX
)
endif()

if(${HAVE_BOOST_UNITS})
add_definitions(
Expand Down

0 comments on commit 41ba71b

Please sign in to comment.