I have the googlebenchmark source code in ~/usr/local
and build
the whole thing with cmake -DCMAKE_BUILD_TYPE=Release
from inside build
:
cd build; cmake -DCMAKE_BUILD_TYPE=Release; make
,
and then in my project's CMakeLists.txt
I have the following:
set(BENCHMARK_ROOT ~/local/benchmark/build/src)
set(BENCHMARK_INCLUDE_DIR ~/local/benchmark/include)
I would like to keep the library in my home directory, as is shown here,
and it works fine with this set-up; my C++
project can see benchmark
.
However, the warning ***WARNING*** Library was built as DEBUG. Timings may be affected.
is still there, so I believe the README.md
does not tell the whole story.
How to fix this? I even tried with
cmake -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON ../
so that it actually downloads googletest
and stores it in third_party
directory inside build
. However, issuing make
leads it to an error: it cannot find the googletest
it has just built.
EDIT: I've included
if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DNDEBUG)
endif()
into the CMakeLists.txt
of benchmark
, still the warning persists.
The approach has been suggested https://stackoverflow.com/questions/34302265/does-cmake-build-type-release-imply-dndebug