Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Generate files correctely with gras_stub_generator.
[simgrid.git] / examples / gras / properties / CMakeLists.txt
index ca58773..ab5453b 100644 (file)
@@ -1,15 +1,26 @@
 cmake_minimum_required(VERSION 2.6)
 
-set_source_files_properties(_properties_simulator.c _properties_alice.c _properties_bob.c
-PROPERTIES GENERATED true)
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/_properties_simulator.c
+                                                       ${CMAKE_CURRENT_BINARY_DIR}/_properties_alice.c
+                                                       ${CMAKE_CURRENT_BINARY_DIR}/_properties_bob.c
+                                                       PROPERTIES GENERATED true)
 
-set(EXECUTABLE_OUTPUT_PATH "./")
-set(LIBRARY_OUTPUT_PATH "${PROJECT_DIRECTORY}/lib")
-
-add_executable(properties_simulator _properties_simulator.c properties.c)
-add_executable(properties_alice _properties_alice.c    properties.c)
-add_executable(properties_bob _properties_bob.c    properties.c)
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
 
+add_executable(properties_simulator ${CMAKE_CURRENT_BINARY_DIR}/_properties_simulator.c
+                                                                       ${CMAKE_CURRENT_SOURCE_DIR}/properties.c)
+add_executable(properties_alice ${CMAKE_CURRENT_BINARY_DIR}/_properties_alice.c
+                                                               ${CMAKE_CURRENT_SOURCE_DIR}/properties.c)
+add_executable(properties_bob  ${CMAKE_CURRENT_BINARY_DIR}/_properties_bob.c
+                                                               ${CMAKE_CURRENT_SOURCE_DIR}/properties.c)
+add_custom_command(
+                                       OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/_properties_simulator.c
+                                                       ${CMAKE_CURRENT_BINARY_DIR}/_properties_alice.c
+                                                       ${CMAKE_CURRENT_BINARY_DIR}/_properties_bob.c
+                                       DEPENDS gras_stub_generator ${CMAKE_CURRENT_SOURCE_DIR}/properties.xml
+                                       COMMAND ${CMAKE_BINARY_DIR}/bin/gras_stub_generator properties ${CMAKE_CURRENT_SOURCE_DIR}/properties.xml
+                                       )
+                                       
 ### Add definitions for compile
 target_link_libraries(properties_simulator simgrid pthread m -fprofile-arcs)
 target_link_libraries(properties_alice gras pthread m -fprofile-arcs)