From ef56f511fff9a700c1be3cad7df617e4b875b678 Mon Sep 17 00:00:00 2001
From: Marcel Koch <marcel.koch@uni-muenster.de>
Date: Fri, 22 Feb 2019 10:48:29 +0100
Subject: [PATCH] use guard at correct place

---
 cmake/modules/DuneCodegenMacros.cmake | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/cmake/modules/DuneCodegenMacros.cmake b/cmake/modules/DuneCodegenMacros.cmake
index e024d28e..d8ebdb87 100644
--- a/cmake/modules/DuneCodegenMacros.cmake
+++ b/cmake/modules/DuneCodegenMacros.cmake
@@ -81,7 +81,9 @@
 
 find_package(benchmark)
 
-find_package(likwid)
+if (DUNE_CODEGEN_PROFILING)
+  find_package(likwid)
+endif()
 
 add_custom_target(generation)
 
@@ -209,9 +211,6 @@ function(add_generated_executable)
   add_executable(${GEN_TARGET} ${GEN_EXCLUDE_FROM_ALL} ${GEN_SOURCE} ${header_deps})
   target_include_directories(${GEN_TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
   add_dependencies(generation ${GEN_TARGET})
-  if (DUNE_CODEGEN_PROFILING AND likwid_FOUND)
-    target_link_libraries(${GEN_TARGET} ${likwid_LIBRARIES})
-  endif ()
 endfunction()
 
 include(GeneratedSystemtests)
-- 
GitLab