IVGCVSW-4402 add boost and armnn path to sample dynamic backend

Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com>
Change-Id: Ibeed3301352d8f15e144f8466d8a26b21c744b84
diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt
index 5505de0..2ff556c 100644
--- a/samples/CMakeLists.txt
+++ b/samples/CMakeLists.txt
@@ -3,7 +3,7 @@
     target_link_libraries(SimpleSample armnn ${CMAKE_THREAD_LIBS_INIT})
 endif()
 
-if(SAMPLE_DYNAMIC_BACKEND)
+if(BUILD_SAMPLE_APP AND SAMPLE_DYNAMIC_BACKEND)
     add_executable(DynamicSample DynamicSample.cpp)
     target_link_libraries(DynamicSample armnn ${CMAKE_THREAD_LIBS_INIT})
 endif()