2 \page cmake SimGrid Developer Guide - Cmake
4 \section cmake_dev_guide_src How to add sources?
6 If you want modified, add or delete source files from a library you have to edit <project/directory>/buildtools/Cmake/DefinePackages.cmake.
7 Chose the section you are interested in and modifie it.
16 src/smpi/smpi_global.c
19 src/smpi/smpi_mpi_dt.c
21 src/smpi/smpi_replay.c
25 If source file are a part of an option library (like fortran smpi source) you have to had it in the compiled sources
26 or in the EXTRA_DIST files package which is only copy in the dist.
28 ### If f2c is installed compiled source other-whise source is only copy in the dist
42 \section cmake_dev_guide_ex How to add examples?
44 If you want make an example you have to create a CMakeList.txt to the src directory.
45 You must specified where to create the executable, source list, dependencies and the name of the binary.
48 cmake_minimum_required(VERSION 2.6)
50 set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
52 add_executable(Hello Hello.c)
54 ### Add definitions for compile
55 target_link_libraries(Hello simgrid)
57 ### You have to put all new files in the apropriated section
58 ### If they are not there, they can't be on the dist package.
69 ${CMAKE_CURRENT_SOURCE_DIR}/Hello.c
82 Then you have to modified :
83 \li<project/directory>/buildtools/Cmake/MakeExeLib.cmake and add line:
85 add_subdirectory(${CMAKE_HOME_DIRECTORY}/<path_where_is_CMakeList.txt>)
88 \li <project/directory>/buildtools/Cmake/DefinePackages.cmake to add your CMakeLists to CMAKE_SOURCE_FILES:
90 set(CMAKE_SOURCE_FILES
93 <path_where_is_CMakeList.txt>
97 \section cmake_dev_guide_test How to add tests?
98 To add a test in simgrid you have to modify source <project/directory>/buildtools/Cmake/AddTests.cmake. Create a new test with adding this line:
101 # ADD_TEST(test-name ${CMAKE_BINARY_DIR}/bin/tesh <options> <tesh-file>)
102 # option --setenv bindir set the directory containing the binary
103 # --setenv srcdir set the directory containing the source file
104 # --cd set the working directory
105 ADD_TEST(my-test-name ${CMAKE_BINARY_DIR}/bin/tesh
106 --setenv bindir=${CMAKE_BINARY_DIR}/examples/my-test/
107 --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/my-test/
108 --cd ${CMAKE_HOME_DIRECTORY}/examples/my-test/
109 ${CMAKE_HOME_DIRECTORY}/examples/msg/io/io.tesh
115 # ADD_TEST(NAME <name>]
116 # [WORKING_DIRECTORY dir]
117 # COMMAND <command> [arg1 [arg2 ...]])
118 ADD_TEST(NAME my-test-name
119 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/examples/my-test/