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 pcre ws2_32 pthread)
9 set(LIBRARIES_DEP simgrid pcre 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 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("$ENV{SIMGRID_ROOT}" STREQUAL "")
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("$ENV{SIMGRID_ROOT}" STREQUAL "")
37 RELATIVE ${CMAKE_HOME_DIRECTORY}/
40 string(REPLACE ".c" "" TARGET_NAME ${SOURCE_FILE})
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})