1 ### This is a template for building targets with simgrid
2 cmake_minimum_required(VERSION 2.8)
4 ### Need to set rc ccompiler before enable language
6 SET(CMAKE_RC_COMPILER "windres")
7 set(LIBRARIES_DEP simgrid ws2_32 pthread)
9 set(LIBRARIES_DEP simgrid pthread)
12 project(MY_SIMGRID_PROJECT C)
14 set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE)
15 set(CMAKE_EXE_LINKER_FLAGS "" CACHE TYPE INTERNAL FORCE)
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")
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")
36 RELATIVE ${CMAKE_HOME_DIRECTORY}/
39 string(REPLACE ".c" "" TARGET_NAME ${SOURCE_FILE})
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})