Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
handle MPI_IN_PLACE for basic reduce
[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 ws2_32 pthread)
8 else()
9   set(LIBRARIES_DEP simgrid 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 message(STATUS "Looking for lib Simgrid")
21 if("$ENV{SIMGRID_ROOT}" STREQUAL "")
22   message(STATUS "Looking for lib Simgrid - Not found")
23   message(FATAL_ERROR "Simgrid not found, reinstall it or set SIMGRID_ROOT")
24 else()
25   link_directories($ENV{SIMGRID_ROOT}/lib)
26   include_directories($ENV{SIMGRID_ROOT}/include)
27   include_directories($ENV{SIMGRID_ROOT}/src)
28   include_directories($ENV{SIMGRID_ROOT}/src/include)
29   message(STATUS "Looking for lib Simgrid - found")
30 endif()
31
32 ################
33 # FIND TARGETS #
34 ################
35 file(GLOB SOURCE_FILE
36   RELATIVE ${CMAKE_HOME_DIRECTORY}/
37   "*.c"
38   )
39 string(REPLACE ".c" "" TARGET_NAME ${SOURCE_FILE})
40
41 foreach(target "${TARGET_NAME}")
42   add_executable(${target} "${target}.c")
43   message(STATUS "source_file: ${target}.c")
44   message(STATUS "target name: ${target}.exe")
45   # Any targets need to be linked with libraries
46   target_link_libraries(${target} ${LIBRARIES_DEP})
47 endforeach(target ${SOURCE_FILE})