Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : ignore variable about time used with tracing
[simgrid.git] / doc / HelloWorld / CMakeLists.txt
1 ### This is a template for building targets with simgrid
2 cmake_minimum_required(VERSION 2.8)
3
4 ### Need to set rc ccompiler before enable language
5 if(WIN32)
6   SET(CMAKE_RC_COMPILER "windres")
7   set(LIBRARIES_DEP simgrid pcre ws2_32 pthread)
8 else()
9   set(LIBRARIES_DEP simgrid pcre pthread)
10 endif()
11
12 project(MY_SIMGRID_PROJECT C)
13
14 set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE)
15 set(CMAKE_EXE_LINKER_FLAGS "" CACHE TYPE INTERNAL FORCE)
16
17 ###############################
18 # Test the build dependencies #
19 ###############################
20 include(FindPcreWin.cmake)
21 message(STATUS "Looking for lib Simgrid")
22 if("$ENV{SIMGRID_ROOT}" STREQUAL "")
23   message(STATUS "Looking for lib Simgrid - Not found")
24   message(FATAL_ERROR "Simgrid not found, reinstall it or set SIMGRID_ROOT")
25 else()
26   link_directories($ENV{SIMGRID_ROOT}/lib)
27   include_directories($ENV{SIMGRID_ROOT}/include)
28   include_directories($ENV{SIMGRID_ROOT}/src)
29   include_directories($ENV{SIMGRID_ROOT}/src/include)
30   message(STATUS "Looking for lib Simgrid - found")
31 endif()
32
33 ################
34 # FIND TARGETS #
35 ################
36 file(GLOB SOURCE_FILE
37   RELATIVE ${CMAKE_HOME_DIRECTORY}/
38   "*.c"
39   )
40 string(REPLACE ".c" "" TARGET_NAME ${SOURCE_FILE})
41
42 foreach(target "${TARGET_NAME}")
43   add_executable(${target} "${target}.c")
44   message(STATUS "source_file: ${target}.c")
45   message(STATUS "target name: ${target}.exe")
46   # Any targets need to be linked with libraries
47   target_link_libraries(${target} ${LIBRARIES_DEP})
48 endforeach(target ${SOURCE_FILE})