Skip to content

Commit

Permalink
cmake: Fix build without benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisv committed Jan 9, 2025
1 parent 527d87d commit 8407d27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ add_subdirectory(unittest)
add_subdirectory(examples)

# --- BENCHMARKS ---------------------------------------------------------------
add_subdirectory(benchmark)
if(BUILD_BENCHMARK)
add_subdirectory(benchmark)
endif()

# --- PACKAGING ----------------------------------------------------------------
macro(EXPORT_VARIABLE var_name var_value)
Expand Down
7 changes: 2 additions & 5 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# --- BENCHMARK --------------------------------------
# ----------------------------------------------------
add_custom_target(bench)

add_project_private_dependency(benchmark REQUIRED)

macro(ADD_PINOCCHIO_BENCH bench_name)
Expand All @@ -14,11 +15,7 @@ macro(ADD_PINOCCHIO_BENCH bench_name)
set(multiValueArgs PACKAGES)
cmake_parse_arguments(unit_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(BUILD_BENCHMARK)
add_executable(${bench_name} ${bench_name}.cpp)
else()
add_executable(${bench_name} EXCLUDE_FROM_ALL ${bench_name}.cpp)
endif()
add_executable(${bench_name} ${bench_name}.cpp)

target_compile_definitions(${bench_name} PRIVATE PINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")
if(NOT unit_test_HEADER_ONLY)
Expand Down

0 comments on commit 8407d27

Please sign in to comment.