Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions TUNING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ Boost.Container (https://www.boost.org/doc/libs/release/libs/container) is being

As the used library is header-only implementation you only need to install the package on the system you build the binary on but not on the system you run the analysis on.

The official Windows binary is currently not using this (TODO: file ticket).
The official Windows binary is currently not using this - see https://trac.cppcheck.net/ticket/13823 for details.

(TODO: enable usage by default / bail out when it is enforced)
This will be used by default if Boost is detected in CMake. If you want to enforce the usage, you can use the CMake option `-DUSE_BOOST=On` which will cause the build to fail if no Boost was detected.

Using Visual Studio you need to provide a full Boost release (i.e. including binaries) for it to be detected by CMake. If you are not able to do this you can specify the CMake option `-DBOOST_INCLUDEDIR=<in>` (pointing to the directory which *contains* the `boost` include directory) to work around this (this is a Cppcheck specific hack) - see https://trac.cppcheck.net/ticket/13822 for more details.

If you are using `make` instead you need to specify `-DHAVE_BOOST` in the flags.

(TODO: document how to use with provided Visual Studio project)

### Use A Different Compiler

Expand Down
16 changes: 15 additions & 1 deletion cmake/findDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,21 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30")
endif()

if(USE_BOOST)
if(USE_BOOST STREQUAL "Auto")
# with Visual Studio Boost is not detected by CMake unless you provide a full release even if only used header-only.
# to work around this we allow to externally set BOOST_INCLUDEDIR.
# see https://trac.cppcheck.net/ticket/13822 for more details.
if(BOOST_INCLUDEDIR)
if(NOT MSVC)
message(FATAL_ERROR "BOOST_INCLUDEDIR hack only allowed for Visual Studio")
endif()
message(STATUS "Using BOOST_INCLUDEDIR hack for Visual Studio")
if(NOT IS_READABLE "${BOOST_INCLUDEDIR}/boost/container/small_vector.hpp")
message(FATAL_ERROR "Provided BOOST_INCLUDEDIR does not appear to contain Boost includes")
endif()
set(Boost_FOUND ON)
set(Boost_INCLUDE_DIRS "${BOOST_INCLUDEDIR}")
# TODO: set Boost_VERSION_STRING
elseif(USE_BOOST STREQUAL "Auto")
find_package(Boost)
else()
find_package(Boost REQUIRED)
Expand Down