Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cdash cosmetics.
[simgrid.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 exec_program("rm ${Project_BINARY_DIR}/CTestTestfile.cmake" OUTPUT_VARIABLE rmok)
3 SET(CMAKE_LANGUAGE "Cxx")
4 SET(PROJECT_NAME "Simgrid")
5 SET(PROJECT_LABEL "Simgrid")
6 set(simgrid_version "3.4")
7 set(USE_RPATH false)
8
9 ### Find programs and paths
10 find_program(SH_EXE NAMES sh)
11 find_program(SED_EXE NAMES sed)
12 find_program(PWD_EXE NAMES pwd)
13 find_program(UNAME NAMES uname)
14 find_program(HOSTNAME_CMD NAMES hostname)
15 find_program(CAT NAMES cat)
16 find_path(GCC_PATH NAMES gcc PATHS NO_DEFAULT_PATHS)
17 find_path(GCOV_PATH NAMES gcov PATHS NO_DEFAULT_PATHS)
18 find_path(VALGRIND_PATH NAMES valgrind  PATHS NO_DEFAULT_PATHS)
19
20 ### SET THE PROJECT_DIRECTORY
21 SET(PROJECT_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
22
23 ### Set some variables for Cmake
24 SET(PROJECT_SOURCE_DIRECTORY "${PROJECT_DIRECTORY}/src")
25 set(EXECUTABLE_OUTPUT_PATH "${PROJECT_DIRECTORY}/bin")
26 set(LIBRARY_OUTPUT_PATH "${PROJECT_DIRECTORY}/src/.libs")
27 set(INCLUDES "-I${PROJECT_DIRECTORY}/include -I${PROJECT_DIRECTORY}/src/include -I${PROJECT_DIRECTORY}/src -I/usr/include/ -L${gtnets_path}/lib")
28 set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIRECTORY})
29
30
31 if(enable_coverage)
32         add_definitions (${INCLUDES} -fprofile-arcs -ftest-coverage)
33 else(enable_coverage)
34         add_definitions (${INCLUDES})
35 endif(enable_coverage)
36
37 ### Setup Options
38 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeOption.txt)
39
40 ### Make the *.h files with *.h.in files
41 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeCompleteInFiles.txt)
42
43 ### Define source packages for Libs 
44 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDefinePackages.txt)
45
46 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMaintainerMode.txt)
47
48 ### Setup gcc flags
49 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeFlags.txt)
50
51 ### Make Libs and Exes
52 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeMakeExeLib.txt)
53
54 ### Make tests
55 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeTest.txt)
56 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CTestConfig.cmake)
57
58 ### Setup the distrib
59 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeDistrib.txt)
60
61 ### Print ARGS
62 include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakePrintArgs.txt)
63
64 INCLUDE(Dart)
65
66 exec_program("ctest -N" OUTPUT_VARIABLE LIST_OF_TEST)
67 string(REPLACE "\n" ";" LIST_OF_TEST ${LIST_OF_TEST})
68 foreach(test ${LIST_OF_TEST})
69         string(REGEX REPLACE "^.*Test.*project.*" " " test ${test})
70         string(REGEX REPLACE "^.*Total.*Tests:.*" " " test ${test})
71         string(REGEX MATCH "^.*Testing.*" test_ok_1 ${test}) #for ctest version 2.6 (xxx/xxx Testing)
72         string(REGEX MATCH "^.*Test.*\\:+" test_ok_2 ${test}) #for ctest version 2.8 (Test #xxx)
73         if(test_ok_1 OR test_ok_2)
74                 string(REGEX REPLACE "^.*Testing" " " test ${test}) #for ctest version 2.6
75                 string(REGEX REPLACE "^.*Test.*\\:+" " " test ${test}) #for ctest version 2.8
76                 string(STRIP ${test} test)
77                 set_tests_properties(${test} PROPERTIES LABELS "rev${SVN_VERSION}")
78         endif(test_ok_1 OR test_ok_2)
79 endforeach(test ${LIST_OF_TEST})