Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Link to lib simgrid work when compil out of build source.
[simgrid.git] / examples / gras / console / CMakeLists.txt
1 if(HAVE_LUA)
2 cmake_minimum_required(VERSION 2.6)
3
4 set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/_ping_simulator.c
5                                                         ${CMAKE_CURRENT_SOURCE_DIR}/_ping_client.c 
6                                                         ${CMAKE_CURRENT_SOURCE_DIR}/_ping_server.c
7                             PROPERTIES GENERATED true)
8
9 set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
10
11 add_executable(ping_simulator_console   ${CMAKE_CURRENT_SOURCE_DIR}/_ping_simulator.c
12                                                                                 ${CMAKE_CURRENT_SOURCE_DIR}/ping_server.c
13                                                                                 ${CMAKE_CURRENT_SOURCE_DIR}/ping_client.c
14                                                                                 ${CMAKE_CURRENT_SOURCE_DIR}/ping_common.c)
15                                                                 
16 add_executable(ping_client_console      ${CMAKE_CURRENT_SOURCE_DIR}/_ping_client.c
17                                                                                 ${CMAKE_CURRENT_SOURCE_DIR}/ping_client.c
18                                                                                 ${CMAKE_CURRENT_SOURCE_DIR}/ping_common.c)
19                                                                 
20 add_executable(ping_server_console      ${CMAKE_CURRENT_SOURCE_DIR}/_ping_server.c
21                                                                                 ${CMAKE_CURRENT_SOURCE_DIR}/ping_server.c
22                                                                                 ${CMAKE_CURRENT_SOURCE_DIR}/ping_common.c)
23
24 add_custom_command(
25                                         OUTPUT  ${CMAKE_CURRENT_SOURCE_DIR}/_ping_simulator.c 
26                                                 ${CMAKE_CURRENT_SOURCE_DIR}/_ping_client.c 
27                                                         ${CMAKE_CURRENT_SOURCE_DIR}/_ping_server.c
28                                         COMMAND lua ${CMAKE_CURRENT_SOURCE_DIR}/ping_generator.lua
29                                         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} #needed to find simgrid.so. By default CMAKE_CURRENT_BINARY_DIR
30                                         )
31 ### Add definitions for compile
32 target_link_libraries(ping_simulator_console simgrid pthread m )
33 target_link_libraries(ping_client_console gras pthread m )
34 target_link_libraries(ping_server_console gras pthread m )
35 endif(HAVE_LUA)