Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
do not build the examples by default, only when running 'make tests'
[simgrid.git] / examples / msg / CMakeLists.txt
index c59540c..20494aa 100644 (file)
@@ -5,31 +5,35 @@ foreach(x app-masterworker cloud-masterworker
           synchro-semaphore trace-categories 
           trace-route-user-variables trace-link-user-variables trace-masterworker
           trace-process-migration trace-host-user-variables)
-  add_executable       (${x}     ${x}/${x}.c)
-  target_link_libraries(${x}     simgrid)
+  add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.c)
+  target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+  add_dependencies(tests ${x})
   set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
   set(tesh_files   ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
 endforeach()
 
 # CPP examples
 foreach(x maestro-set)
-  add_executable       (${x}     ${x}/${x}.cpp)
+  add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.cpp)
   target_link_libraries(${x}     simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+  add_dependencies(tests ${x})
   set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
   set(tesh_files   ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
 endforeach()
 
 if(SIMGRID_HAVE_NS3)
-  add_executable       (network-ns3 network-ns3/network-ns3.c)
+  add_executable       (network-ns3 EXCLUDE_FROM_ALL network-ns3/network-ns3.c)
   target_link_libraries(network-ns3 simgrid)
   set_target_properties(network-ns3  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/network-ns3)
+  add_dependencies(tests network-ns3)    
 endif()
 
-add_executable       (dht-kademlia dht-kademlia/dht-kademlia.c dht-kademlia/node.c dht-kademlia/routing_table.c dht-kademlia/task.c dht-kademlia/answer.c)
+add_executable       (dht-kademlia EXCLUDE_FROM_ALL dht-kademlia/dht-kademlia.c dht-kademlia/node.c dht-kademlia/routing_table.c dht-kademlia/task.c dht-kademlia/answer.c)
 target_link_libraries(dht-kademlia simgrid)
 set_target_properties(dht-kademlia PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dht-kademlia)
+add_dependencies(tests dht-kademlia)
 foreach (file answer dht-kademlia node routing_table task)
   set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.c  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.h)
 endforeach()