Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Definitively remove old variable PROJECT_DIRECTORY for CMAKE_HOME_DIRECTORY.
[simgrid.git] / buildtools / Cmake / CompleteInFiles.cmake
1 set(CMAKE_MODULE_PATH 
2 ${CMAKE_MODULE_PATH}
3 ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules
4 )
5 include(CheckFunctionExists)
6 include(CheckIncludeFile)
7 include(CheckIncludeFiles)
8 include(CheckLibraryExists)
9 include(TestBigEndian)
10 include(FindGraphviz)
11 TEST_BIG_ENDIAN(BIGENDIAN)
12
13 # Checks for header libraries functions.
14 CHECK_LIBRARY_EXISTS(pthread    pthread_create          NO_DEFAULT_PATHS pthread)
15 CHECK_LIBRARY_EXISTS(pthread    sem_init                NO_DEFAULT_PATHS HAVE_SEM_INIT_LIB)
16 CHECK_LIBRARY_EXISTS(pthread    sem_timedwait           NO_DEFAULT_PATHS HAVE_SEM_TIMEDWAIT_LIB)
17 CHECK_LIBRARY_EXISTS(pthread    pthread_mutex_timedlock NO_DEFAULT_PATHS HAVE_MUTEX_TIMEDLOCK_LIB)
18 CHECK_LIBRARY_EXISTS(rt         clock_gettime           NO_DEFAULT_PATHS HAVE_POSIX_GETTIME)
19
20 CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
21 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
22 CHECK_INCLUDE_FILE("pthread.h" HAVE_PTHREAD_H)
23 CHECK_INCLUDE_FILE("valgrind/valgrind.h" HAVE_VALGRIND_VALGRIND_H)
24 CHECK_INCLUDE_FILE("socket.h" HAVE_SOCKET_H)
25 CHECK_INCLUDE_FILE("sys/socket.h" HAVE_SYS_SOCKET_H)
26 CHECK_INCLUDE_FILE("stat.h" HAVE_STAT_H)
27 CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
28 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
29 CHECK_INCLUDE_FILE("winsock.h" HAVE_WINSOCK_H)
30 CHECK_INCLUDE_FILE("winsock2.h" HAVE_WINSOCK2_H)
31 CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
32 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
33 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
34 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
35 CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
36 CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
37 CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
38 CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
39 CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
40 CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
41 CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
42 CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
43 CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
44 CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
45
46 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
47 CHECK_FUNCTION_EXISTS(usleep HAVE_USLEEP)
48 CHECK_FUNCTION_EXISTS(getdtablesize HAVE_GETDTABLESIZE)
49 CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
50 CHECK_FUNCTION_EXISTS(readv HAVE_READV)
51 CHECK_FUNCTION_EXISTS(popen HAVE_POPEN)
52 CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
53 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
54 CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF)
55 CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF)
56 CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
57 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
58 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
59
60 if(WIN32) #THOSE FILES ARE FUNCTIONS ARE NOT DETECTED BUT THEY SHOULD...
61     set(HAVE_UCONTEXT_H 1)
62     set(HAVE_MAKECONTEXT 1)
63     set(HAVE_SNPRINTF 1)
64     set(HAVE_VSNPRINTF 1)
65 endif(WIN32)
66
67 set(CONTEXT_UCONTEXT 0)
68 SET(CONTEXT_THREADS 0)
69 SET(HAVE_RUBY 0)
70 set(HAVE_LUA 0)
71 SET(HAVE_JAVA 0)
72 SET(HAVE_TRACING 0)
73
74 if(enable_tracing)
75         SET(HAVE_TRACING 1)
76 endif(enable_tracing)
77
78 if(enable_latency_bound_tracking)
79         SET(HAVE_LATENCY_BOUND_TRACKING 1)
80 else(enable_latency_bound_tracking)
81   if(enable_gtnets)
82     message("turning latency_bound_tracking to ON because GTNeTs is ON")
83     SET(enable_latency_bound_tracking ON)
84     SET(HAVE_LATENCY_BOUND_TRACKING 1)
85   else(enable_gtnets)
86     SET(HAVE_LATENCY_BOUND_TRACKING 0)
87   endif(enable_gtnets)
88 endif(enable_latency_bound_tracking)
89
90 if(enable_model-checking AND HAVE_MMAP)
91         SET(HAVE_MC 1)
92         SET(MMALLOC_WANT_OVERIDE_LEGACY 1)
93 else(enable_model-checking AND HAVE_MMAP)
94         SET(HAVE_MC 0)
95         SET(MMALLOC_WANT_OVERIDE_LEGACY 0)
96 endif(enable_model-checking AND HAVE_MMAP)
97
98 if(enable_lua)
99         include(FindLua51Simgrid)
100         if(LUA51_FOUND)
101                 set(HAVE_LUA 1)
102                 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${LUA_INCLUDE_DIR} ")
103                 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${LUA_LIBRARY_DIR} ")
104         else(LUA51_FOUND)
105                 message("Lua binding need version 5.1 and cmake version 2.8")
106                 message("Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
107         endif(LUA51_FOUND)
108 endif(enable_lua)
109
110 if(enable_ruby)
111         include(FindRuby)
112         if(RUBY_LIBRARY)
113                 if(RUBY_VERSION_MAJOR MATCHES "1" AND RUBY_VERSION_MINOR MATCHES "8")
114                         set(LIB_RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
115                         string(REGEX MATCH "ruby.*[0-9]" RUBY_LIBRARY_NAME ${RUBY_LIBRARY})
116                         if(NOT RUBY_LIBRARY_NAME)
117                                 set(RUBY_LIBRARY_NAME ruby)
118                         endif(NOT RUBY_LIBRARY_NAME)
119                         string(REGEX REPLACE "/libruby.*$" "" RUBY_LIBRARY ${RUBY_LIBRARY})
120                         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${RUBY_CONFIG_INCLUDE_DIR} ") #path to config.h
121                         string(COMPARE EQUAL "${RUBY_INCLUDE_DIR}" "${RUBY_CONFIG_INCLUDE_DIR}" operation)
122                         if(NOT operation)
123                                 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${RUBY_INCLUDE_DIR} ") #path to ruby.h
124                         endif(NOT operation)
125                         ADD_DEFINITIONS("-I${CMAKE_HOME_DIRECTORY}/src/bindings/ruby -I${CMAKE_HOME_DIRECTORY}/src/simix")
126                         SET(HAVE_RUBY 1)
127                 else(RUBY_VERSION_MAJOR MATCHES "1" AND RUBY_VERSION_MINOR MATCHES "8")
128                         message("Ruby binding need version 1.8.x actually version ${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.x")
129                         SET(HAVE_RUBY 0)
130                 endif(RUBY_VERSION_MAJOR MATCHES "1" AND RUBY_VERSION_MINOR MATCHES "8")
131         else(RUBY_LIBRARY)
132                 SET(HAVE_RUBY 0)
133         endif(RUBY_LIBRARY)
134         
135         if(NOT RUBY_EXECUTABLE)
136                 message("Take care : you don't have ruby executable so you can compile and build examples but can't execute them!!!") 
137         endif(NOT RUBY_EXECUTABLE)
138         
139 endif(enable_ruby)
140
141 #--------------------------------------------------------------------------------------------------
142 ### Initialize of Smpi
143
144 if(enable_smpi)
145         include(FindF2c)
146         if(HAVE_F2C_H)
147        string(REGEX MATCH "-I${HAVE_F2C_H} " operation "${CMAKE_C_FLAGS}")
148            if(NOT operation)
149                         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${HAVE_F2C_H} ")
150            endif(NOT operation)
151         else(HAVE_F2C_H)
152                 message("-- You should install f2c before use smpi.")
153         endif(HAVE_F2C_H)       
154 endif(enable_smpi)
155
156 #--------------------------------------------------------------------------------------------------
157 ### Initialize of CONTEXT JAVA
158
159 if(enable_java)
160         include(FindJava)
161         include(FindJNI)
162         if(JAVA_INCLUDE_PATH)
163                 set(HAVE_JNI_H 1)
164         endif(JAVA_INCLUDE_PATH)        
165         if(JAVA_COMPILE AND JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2)
166                 SET(HAVE_JAVA 1)
167                 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${JAVA_INCLUDE_PATH} ")
168                 if(NOT JAVA_INCLUDE_PATH STREQUAL JAVA_INCLUDE_PATH2)
169                 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${JAVA_INCLUDE_PATH2} ")                   
170                 endif(NOT JAVA_INCLUDE_PATH STREQUAL JAVA_INCLUDE_PATH2)
171         else(JAVA_COMPILE AND JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2) 
172                 SET(HAVE_JAVA 0)
173         endif(JAVA_COMPILE AND JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2)
174 endif(enable_java)
175
176 #--------------------------------------------------------------------------------------------------
177 ### Initialize of CONTEXT GTNETS
178 if(NOT enable_gtnets OR enable_supernovae)
179         SET(HAVE_GTNETS 0)
180 else(NOT enable_gtnets OR enable_supernovae)
181         set(GTNETS_LDFLAGS "-L${gtnets_path}/lib")
182         set(GTNETS_CPPFLAGS "-I${gtnets_path}/include/gtnets")
183         exec_program("${CMAKE_CXX_COMPILER} ${GTNETS_CPPFLAGS} -lgtnets ${GTNETS_LDFLAGS} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gtnets.cpp " OUTPUT_VARIABLE COMPILE_GTNETS_VAR)      
184         if(COMPILE_GTNETS_VAR)
185                 SET(HAVE_GTNETS 0)
186         else(COMPILE_GTNETS_VAR)
187                 SET(HAVE_GTNETS 1)
188                 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ")
189                 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ")
190                 string(REGEX MATCH "${gtnets_path}/lib" operation "$ENV{LD_LIBRARY_PATH}")
191                 if(NOT operation)
192                         message(FATAL_ERROR "\n\nTo use GTNETS don't forget to set LD_LIBRARY_PATH with \n\texport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${gtnets_path}/lib\n\n")
193                 endif(NOT operation)
194         endif(COMPILE_GTNETS_VAR)
195 endif(NOT enable_gtnets OR enable_supernovae)
196
197 #--------------------------------------------------------------------------------------------------
198 #--------------------------------------------------------------------------------------------------
199 ### Initialize of pcre
200 find_library(PATH_PCRE_LIB pcre)
201 find_file(PATH_PCRE_H "pcre.h")
202 set(HAVE_PCRE_LIB 0)
203 if(PATH_PCRE_LIB AND PATH_PCRE_H)
204        string(REGEX REPLACE "/libpcre.*[.]${LIB_EXE}$" "" PATHLIBPCRE "${PATH_PCRE_LIB}")
205        string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}")
206        string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
207            if(NOT operation)
208                         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ")
209            endif(NOT operation)
210            string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}")
211            if(NOT operation)
212                         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ")
213            endif(NOT operation)    
214        set(HAVE_PCRE_LIB 1)
215 else(PATH_PCRE_LIB)
216                 message("You should install libpcre (please install the libpcre3-dev package or equivalent)")
217 endif(PATH_PCRE_LIB AND PATH_PCRE_H)
218
219 #--------------------------------------------------------------------------------------------------
220 ### Initialize of CONTEXT THREADS
221
222 if(pthread)
223         set(pthread 1)
224 elseif(pthread)
225         set(pthread 0)
226 endif(pthread)
227
228 if(pthread)
229         ### HAVE_SEM_INIT
230         
231         if(HAVE_SEM_INIT_LIB)
232                 exec_program("${CMAKE_C_COMPILER} -lpthread ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_init.c" OUTPUT_VARIABLE HAVE_SEM_INIT_run)
233                 if(HAVE_SEM_INIT_run)
234                         set(HAVE_SEM_INIT 0)
235                 else(HAVE_SEM_INIT_run)
236                         set(HAVE_SEM_INIT 1)
237                 endif(HAVE_SEM_INIT_run)
238         endif(HAVE_SEM_INIT_LIB)
239
240         ### HAVE_SEM_TIMEDWAIT
241
242         if(HAVE_SEM_TIMEDWAIT_LIB)
243                 exec_program("${CMAKE_C_COMPILER} -lpthread ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_timedwait.c" OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run)
244                 if(HAVE_SEM_TIMEDWAIT_run)
245                         set(HAVE_SEM_TIMEDWAIT 0)
246                 else(HAVE_SEM_TIMEDWAIT_run)
247                         set(HAVE_SEM_TIMEDWAIT 1)
248                 endif(HAVE_SEM_TIMEDWAIT_run)
249         endif(HAVE_SEM_TIMEDWAIT_LIB)
250
251         ### HAVE_MUTEX_TIMEDLOCK
252
253         if(HAVE_MUTEX_TIMEDLOCK_LIB)
254                 exec_program("${CMAKE_C_COMPILER} -lpthread ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_mutex_timedlock.c" OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run)
255                 if(HAVE_MUTEX_TIMEDLOCK_run)
256                         set(HAVE_MUTEX_TIMEDLOCK 0)
257                 else(HAVE_MUTEX_TIMEDLOCK_run)
258                         set(HAVE_MUTEX_TIMEDLOCK 1)
259                 endif(HAVE_MUTEX_TIMEDLOCK_run)
260         endif(HAVE_MUTEX_TIMEDLOCK_LIB)
261 endif(pthread)
262
263 # AC_CHECK_MCSC(mcsc=yes, mcsc=no) 
264 set(mcsc_flags "")
265 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
266         set(mcsc_flags "-D_XOPEN_SOURCE")
267 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
268
269 if(WIN32)
270     if(__VISUALC__)
271         set(mcsc_flags "/D_XBT_WIN32 /I${CMAKE_HOME_DIRECTORY}/include/xbt /I${CMAKE_HOME_DIRECTORY}/src/xbt")
272         endif(__VISUALC__)
273         if(__GNUC__)
274                 set(mcsc_flags "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
275         endif(__GNUC__)
276 endif(WIN32)
277
278 IF(CMAKE_CROSSCOMPILING)
279         IF(WIN32)
280                 set(windows_context "yes")
281                 set(IS_WINDOWS 1)       
282         ENDIF(WIN32)
283 ELSE(CMAKE_CROSSCOMPILING)
284         try_run(RUN_mcsc_VAR COMPILE_mcsc_VAR
285                 ${simgrid_BINARY_DIR}
286                 ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c
287                 COMPILE_DEFINITIONS "${mcsc_flags}"
288                 OUTPUT_VARIABLE var_compil
289                 )
290                 
291                 if(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
292                         file(READ "${simgrid_BINARY_DIR}/conftestval" mcsc)
293                         STRING(REPLACE "\n" "" mcsc "${mcsc}")
294                         if(mcsc)
295                                 set(mcsc "yes")
296                         elseif(mcsc)
297                                 set(mcsc "no")
298                         endif(mcsc)
299                 else(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
300                         set(mcsc "no")
301                 endif(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
302 ENDIF(CMAKE_CROSSCOMPILING)
303
304 if(mcsc MATCHES "no" AND pthread)
305         if(HAVE_WINDOWS_H)
306                 set(windows_context "yes")
307                 set(IS_WINDOWS 1)
308         elseif(HAVE_WINDOWS_H)
309                 message(FATAL_ERROR "no appropriate backend found")
310         endif(HAVE_WINDOWS_H)
311 endif(mcsc MATCHES "no" AND pthread)
312
313 if(with_context MATCHES "ucontext" AND mcsc MATCHES "no")
314         message(FATAL_ERROR "-Dwith-context=ucontext specified but ucontext unusable.")
315 endif(with_context MATCHES "ucontext" AND mcsc MATCHES "no")
316
317 set(with_context_ok 0)
318 if(with_context MATCHES "windows")
319         set(with_context_ok 1)
320         if(NOT HAVE_WINDOWS_H)
321                 message(FATAL_ERROR "no appropriate backend found windows")
322         endif(NOT HAVE_WINDOWS_H)
323 endif(with_context MATCHES "windows")
324
325 if(with_context MATCHES "pthreads")
326         set(with_context_ok 1)
327         set(with_context "pthread")
328 endif(with_context MATCHES "pthreads")
329
330 if(with_context MATCHES "auto")
331         set(with_context_ok 1)
332         set(with_context "ucontext")
333         message("with_context auto change to ucontext")
334 endif(with_context MATCHES "auto")
335
336 if(with_context MATCHES "ucontext")
337         set(with_context_ok 1)
338         if(mcsc)
339                 set(CONTEXT_UCONTEXT 1)
340         else(mcsc)
341                 if(windows_context MATCHES "yes")
342                         set(with_context "windows")
343                         message("with_context ucontext change to windows")
344                 else(windows_context MATCHES "yes")
345                         set(with_context "pthread")
346                         message("with_context ucontext change to pthread")
347                 endif(windows_context MATCHES "yes")
348         endif(mcsc)
349 endif(with_context MATCHES "ucontext")
350
351 if(with_context MATCHES "pthread")
352         set(with_context_ok 1)
353         if(NOT pthread)
354                 message(FATAL_ERROR "Cannot find pthreads (try -Dwith_context=ucontext if you haven't already tried).")
355         endif(NOT pthread)
356         SET(CONTEXT_THREADS 1)
357 endif(with_context MATCHES "pthread")
358
359 if(with_context MATCHES "ucontext")
360         SET(CONTEXT_THREADS 0)
361 endif(with_context MATCHES "ucontext")
362
363 if(NOT with_context_ok)
364         message(FATAL_ERROR "-Dwith-context must be either ucontext or pthread")
365 endif(NOT with_context_ok)
366
367 ###############
368 ## SVN version check
369 ##
370 if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.svn)
371         find_file(SVN ".svn" ${CMAKE_HOME_DIRECTORY})
372         exec_program("svnversion ${CMAKE_HOME_DIRECTORY}" OUTPUT_VARIABLE "SVN_VERSION")
373         message("SVN_VERSION : ${SVN_VERSION}")
374 endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.svn)
375
376 if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git)
377
378         exec_program("git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --oneline -1" OUTPUT_VARIABLE "GIT_VERSION")
379         exec_program("git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --format=%ai ." OUTPUT_VARIABLE "GIT_DATE")
380         exec_program("git svn info" ${CMAKE_HOME_DIRECTORY} OUTPUT_VARIABLE "GIT_SVN_VERSION")
381         
382         string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
383         STRING(REPLACE " +0000" "" GIT_DATE ${GIT_DATE})
384         STRING(REPLACE " " "~" GIT_DATE ${GIT_DATE})
385         STRING(REPLACE ":" "-" GIT_DATE ${GIT_DATE})
386
387         exec_program("git config --get svn-remote.svn.url"
388                 OUTPUT_VARIABLE url
389                 RETURN_VALUE ret)
390         if(ret EQUAL 0)
391                 exec_program("git svn info" ${CMAKE_HOME_DIRECTORY}
392                         OUTPUT_VARIABLE "GIT_SVN_VERSION")
393                 string(REPLACE "\n" ";" GIT_SVN_VERSION ${GIT_SVN_VERSION})
394                 foreach(line ${GIT_SVN_VERSION})
395                         string(REGEX MATCH "^Revision:.*" line_good ${line})
396                         if(line_good)
397                                 string(REPLACE "Revision: " ""
398                                         line_good ${line_good})
399                                 set(SVN_VERSION ${line_good})
400                         endif(line_good)
401                 endforeach(line ${GIT_SVN_VERSION})
402         endif(ret EQUAL 0)
403 endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git)
404
405 ###################################
406 ## SimGrid and GRAS specific checks
407 ##
408
409 IF(NOT CMAKE_CROSSCOMPILING)
410 # Check architecture signature begin
411 try_run(RUN_GRAS_VAR COMPILE_GRAS_VAR
412         ${simgrid_BINARY_DIR}
413         ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_GRAS_ARCH.c
414         RUN_OUTPUT_VARIABLE var1
415         )
416 if(BIGENDIAN)
417   set(val_big "B${var1}")
418   set(GRAS_BIGENDIAN 1)
419 else(BIGENDIAN)
420   set(val_big "l${var1}")
421   set(GRAS_BIGENDIAN 0)
422 endif(BIGENDIAN)
423
424 if(val_big MATCHES "l_C:1/1:_I:2/1:4/1:4/1:8/1:_P:4/1:4/1:_D:4/1:8/1:")
425         #gras_arch=0; gras_size=32; gras_arch_name=little32_1;
426         SET(GRAS_ARCH_32_BITS 1)
427         SET(GRAS_THISARCH 0)
428 endif(val_big MATCHES "l_C:1/1:_I:2/1:4/1:4/1:8/1:_P:4/1:4/1:_D:4/1:8/1:")
429 if(val_big MATCHES "l_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:")
430         #gras_arch=1; gras_size=32; gras_arch_name=little32_2;
431         SET(GRAS_ARCH_32_BITS 1)
432         SET(GRAS_THISARCH 1)
433 endif(val_big MATCHES "l_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:")
434 if(val_big MATCHES "l_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:") 
435         #gras_arch=2; gras_size=32; gras_arch_name=little32_4;
436         SET(GRAS_ARCH_32_BITS 1)
437         SET(GRAS_THISARCH 2)
438 endif(val_big MATCHES "l_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:")
439 if(val_big MATCHES "l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:") 
440         #gras_arch=3; gras_size=32; gras_arch_name=little32_8;
441         SET(GRAS_ARCH_32_BITS 1)
442         SET(GRAS_THISARCH 3)
443 endif(val_big MATCHES "l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:") 
444 if(val_big MATCHES "l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:") 
445         #gras_arch=4; gras_size=64; gras_arch_name=little64;
446         SET(GRAS_ARCH_32_BITS 0)
447         SET(GRAS_THISARCH 4)
448 endif(val_big MATCHES "l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:")
449
450 if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:") 
451         #gras_arch=5; gras_size=32; gras_arch_name=big32;
452         SET(GRAS_ARCH_32_BITS 1)
453         SET(GRAS_THISARCH 5)
454 endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:")
455 if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4:") 
456         #gras_arch=6; gras_size=32; gras_arch_name=big32_8_4;
457         SET(GRAS_ARCH_32_BITS 1)
458         SET(GRAS_THISARCH 6)
459 endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4:")
460 if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:") 
461         #gras_arch=7; gras_size=32; gras_arch_name=big32_4;
462         SET(GRAS_ARCH_32_BITS 1)
463         SET(GRAS_THISARCH 7)
464 endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:")
465 if(val_big MATCHES "B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:") 
466         #gras_arch=8; gras_size=32; gras_arch_name=big32_2;
467         SET(GRAS_ARCH_32_BITS 1)
468         SET(GRAS_THISARCH 8)
469 endif(val_big MATCHES "B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:") 
470 if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:") 
471         #gras_arch=9; gras_size=64; gras_arch_name=big64;
472         SET(GRAS_ARCH_32_BITS 0)
473         SET(GRAS_THISARCH 9)
474 endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:")
475 if(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4:") 
476         #gras_arch=10;gras_size=64; gras_arch_name=big64_8_4;
477         SET(GRAS_ARCH_32_BITS 0)
478         SET(GRAS_THISARCH 10)
479 endif(val_big MATCHES "B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4:") 
480
481
482 # Check architecture signature end
483 try_run(RUN_GRAS_VAR COMPILE_GRAS_VAR
484         ${simgrid_BINARY_DIR}
485         ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_GRAS_CHECK_STRUCT_COMPACTION.c
486         RUN_OUTPUT_VARIABLE var2
487         )
488 separate_arguments(var2)
489 foreach(var_tmp ${var2})
490         set(${var_tmp} 1)
491 endforeach(var_tmp ${var2})
492
493 # Check for [SIZEOF_MAX]
494 try_run(RUN_SM_VAR COMPILE_SM_VAR
495         ${simgrid_BINARY_DIR}
496         ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_max_size.c
497         RUN_OUTPUT_VARIABLE var3
498         )
499 SET(SIZEOF_MAX ${var3})
500 ENDIF(NOT CMAKE_CROSSCOMPILING)
501
502 #--------------------------------------------------------------------------------------------------
503
504 set(makecontext_CPPFLAGS_2 "")
505 if(HAVE_MAKECONTEXT OR WIN32)
506         set(makecontext_CPPFLAGS "-DTEST_makecontext")
507         if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
508                 set(makecontext_CPPFLAGS_2 "-DOSX")
509         endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
510         
511     if(WIN32 AND __VISUALC__)
512         set(makecontext_CPPFLAGS "/DTEST_makecontext")
513             set(makecontext_CPPFLAGS_2 "/D_XBT_WIN32 /I${CMAKE_HOME_DIRECTORY}/include/xbt /I${CMAKE_HOME_DIRECTORY}/src/xbt")
514         endif(WIN32 AND __VISUALC__)
515         if(WIN32 AND __GNUC__)
516             set(makecontext_CPPFLAGS "-DTEST_makecontext")
517             set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
518         endif(WIN32 AND __GNUC__)
519         
520         try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
521                 ${simgrid_BINARY_DIR}
522                 ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_stacksetup.c
523                 COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
524                 )
525         file(READ ${simgrid_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
526         string(REPLACE "\n" "" MAKECONTEXT_ADDR_SIZE "${MAKECONTEXT_ADDR_SIZE}")
527         string(REGEX MATCH ;^.*,;MAKECONTEXT_ADDR "${MAKECONTEXT_ADDR_SIZE}")
528         string(REGEX MATCH ;,.*$; MAKECONTEXT_SIZE "${MAKECONTEXT_ADDR_SIZE}")
529         string(REPLACE "," "" makecontext_addr "${MAKECONTEXT_ADDR}")
530         string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")   
531         set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
532         set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
533         
534 endif(HAVE_MAKECONTEXT OR WIN32)
535
536 #--------------------------------------------------------------------------------------------------
537
538 ### check for stackgrowth
539 if (NOT CMAKE_CROSSCOMPILING)
540         try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
541                 ${simgrid_BINARY_DIR}
542                 ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_stackgrowth.c
543                 )
544 file(READ "${simgrid_BINARY_DIR}/conftestval" stack)
545 if(stack MATCHES "down")
546         set(PTH_STACKGROWTH "-1")
547 endif(stack MATCHES "down")
548 if(stack MATCHES "up")
549         set(PTH_STACKGROWTH "1")
550 endif(stack MATCHES "up")
551
552 endif(NOT CMAKE_CROSSCOMPILING)
553 ###############
554 ## System checks
555 ##
556
557 #SG_CONFIGURE_PART([System checks...])
558 #AC_PROG_CC(xlC gcc cc) -auto
559 #AM_SANITY_CHECK -auto
560
561 #AC_PROG_MAKE_SET
562
563
564 #AC_PRINTF_NULL
565 try_run(RUN_PRINTF_NULL_VAR COMPILE_PRINTF_NULL_VAR
566         ${simgrid_BINARY_DIR}
567         ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_printf_null.c
568         )
569
570 if(RUN_PRINTF_NULL_VAR MATCHES "FAILED_TO_RUN")
571 SET(PRINTF_NULL_WORKING "0")
572 else(RUN_PRINTF_NULL_VAR MATCHES "FAILED_TO_RUN")
573 SET(PRINTF_NULL_WORKING "1")
574 endif(RUN_PRINTF_NULL_VAR MATCHES "FAILED_TO_RUN")
575
576 #AC_CHECK_VA_COPY
577
578 set(diff_va "va_copy((d),(s))"
579 "VA_COPY((d),(s))"
580 "__va_copy((d),(s))"
581 "__builtin_va_copy((d),(s))"
582 "do { (d) = (s)\; } while (0)"
583 "do { *(d) = *(s)\; } while (0)"
584 "memcpy((void *)&(d), (void *)&(s), sizeof(s))"
585 "memcpy((void *)(d), (void *)(s), sizeof(*(s)))"
586 )
587
588 foreach(fct ${diff_va})
589         write_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_va_copy.c" "#include <stdlib.h>
590         #include <stdarg.h>
591         #include <string.h>
592         #define DO_VA_COPY(d,s) ${fct}
593         void test(char *str, ...)
594         {
595             va_list ap, ap2;
596             int i;
597             va_start(ap, str);
598             DO_VA_COPY(ap2, ap);
599             for (i = 1; i <= 9; i++) {
600                 int k = (int)va_arg(ap, int);
601                 if (k != i)
602                     abort();
603             }
604             DO_VA_COPY(ap, ap2);
605             for (i = 1; i <= 9; i++) {
606                 int k = (int)va_arg(ap, int);
607                 if (k != i)
608                     abort();
609             }
610             va_end(ap);
611         }
612         int main(int argc, char *argv[])
613         {
614             test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9);
615             exit(0);
616         }"
617         )
618         try_compile(COMPILE_VA_NULL_VAR
619         ${simgrid_BINARY_DIR}
620         ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_va_copy.c
621         )
622         if(COMPILE_VA_NULL_VAR)
623                 string(REGEX REPLACE "\;" "" fctbis ${fct})
624                 if(${fctbis} STREQUAL "va_copy((d),(s))")
625                         set(HAVE_VA_COPY 1)
626                         set(ac_cv_va_copy "C99")
627                         set(__VA_COPY_USE_C99 "va_copy((d),(s))")       
628                 endif(${fctbis} STREQUAL "va_copy((d),(s))")
629
630                 if(${fctbis} STREQUAL "VA_COPY((d),(s))")
631                         set(ac_cv_va_copy "GCM")
632                         set(__VA_COPY_USE_GCM "VA_COPY((d),(s))")
633                 endif(${fctbis} STREQUAL "VA_COPY((d),(s))")
634
635                 if(${fctbis} STREQUAL "__va_copy((d),(s))")
636                         set(ac_cv_va_copy "GCH")
637                         set(__VA_COPY_USE_GCH "__va_copy((d),(s))")
638                 endif(${fctbis} STREQUAL "__va_copy((d),(s))")
639
640                 if(${fctbis} STREQUAL "__builtin_va_copy((d),(s))")
641                         set(ac_cv_va_copy "GCB")
642                         set(__VA_COPY_USE_GCB "__builtin_va_copy((d),(s))")
643                 endif(${fctbis} STREQUAL "__builtin_va_copy((d),(s))")
644
645                 if(${fctbis} STREQUAL "do { (d) = (s) } while (0)")
646                         set(ac_cv_va_copy "ASS")
647                         set(__VA_COPY_USE_ASS "do { (d) = (s); } while (0)")
648                 endif(${fctbis} STREQUAL "do { (d) = (s) } while (0)")
649
650                 if(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
651                         set(ac_cv_va_copy "ASP")
652                         set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)")
653                 endif(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
654
655                 if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
656                         set(ac_cv_va_copy "CPS")
657                         set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
658                 endif(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
659
660                 if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
661                         set(ac_cv_va_copy "CPP")
662                         set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
663                 endif(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
664                                 
665                 if(NOT STATUS_OK)
666                 set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)")
667                 endif(NOT STATUS_OK)
668                 set(STATUS_OK "1")
669                 
670         endif(COMPILE_VA_NULL_VAR)
671         
672 endforeach(fct ${diff_va})
673 file(REMOVE "${PROJECT_DIRECTORY}/buildtools/Cmake/test_prog/prog_va_copy.c")
674
675 #--------------------------------------------------------------------------------------------------
676 ### check for getline
677 try_compile(COMPILE_RESULT_VAR
678         ${simgrid_BINARY_DIR}
679         ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_getline.c
680         )
681
682 if(NOT COMPILE_RESULT_VAR)
683 SET(need_getline "#define SIMGRID_NEED_GETLINE 1")
684 SET(SIMGRID_NEED_GETLINE 1)
685 else(NOT COMPILE_RESULT_VAR)
686 SET(need_getline "")
687 SET(SIMGRID_NEED_GETLINE 0)
688 endif(NOT COMPILE_RESULT_VAR)
689
690 ### check for a working snprintf
691 if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
692     if(WIN32)
693         #set(HAVE_SNPRINTF 1)
694         #set(HAVE_VSNPRINTF 1)
695     endif(WIN32)
696     
697         if(CMAKE_CROSSCOMPILING)
698                 set(RUN_SNPRINTF_FUNC "cross")
699                 #set(PREFER_PORTABLE_SNPRINTF 1)
700         else(CMAKE_CROSSCOMPILING)
701             try_run(RUN_SNPRINTF_FUNC_VAR COMPILE_SNPRINTF_FUNC_VAR
702                 ${simgrid_BINARY_DIR}
703                 ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_snprintf.c
704             )   
705         endif(CMAKE_CROSSCOMPILING)
706
707         if(CMAKE_CROSSCOMPILING)
708                 set(RUN_VSNPRINTF_FUNC "cross")
709                 set(PREFER_PORTABLE_VSNPRINTF 1)
710         else(CMAKE_CROSSCOMPILING)
711            try_run(RUN_VSNPRINTF_FUNC_VAR COMPILE_VSNPRINTF_FUNC_VAR
712                 ${simgrid_BINARY_DIR}
713                 ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_vsnprintf.c
714            )
715         endif(CMAKE_CROSSCOMPILING)
716         
717         set(PREFER_PORTABLE_SNPRINTF 0)
718         if(RUN_VSNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
719                 set(PREFER_PORTABLE_SNPRINTF 1)
720         endif(RUN_VSNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
721         if(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
722                 set(PREFER_PORTABLE_SNPRINTF 1)
723         endif(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
724 endif(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
725
726 ### check for asprintf function familly
727 if(HAVE_ASPRINTF)
728         SET(simgrid_need_asprintf "")
729         SET(NEED_ASPRINTF 0)
730 else(HAVE_ASPRINTF)
731         SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
732         SET(NEED_ASPRINTF 1)
733 endif(HAVE_ASPRINTF)
734
735 if(HAVE_VASPRINTF)
736         SET(simgrid_need_vasprintf "")
737         SET(NEED_VASPRINTF 0)
738 else(HAVE_VASPRINTF)
739         SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
740         SET(NEED_VASPRINTF 1)
741 endif(HAVE_VASPRINTF)
742
743 ### check for addr2line
744
745 find_path(ADDR2LINE NAMES addr2line     PATHS NO_DEFAULT_PATHS  )
746 if(ADDR2LINE)
747 set(ADDR2LINE "${ADDR2LINE}/addr2line")
748 endif(ADDR2LINE)
749
750 ### File to create
751
752 configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in"                   "${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
753
754 SET( CMAKEDEFINE "#cmakedefine" )
755 configure_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/gras_config.h.in"      "${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h" @ONLY IMMEDIATE)
756 configure_file("${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h"                  "${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h" @ONLY IMMEDIATE)
757 configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in"            "${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
758
759 set(top_srcdir "${CMAKE_HOME_DIRECTORY}")
760 set(srcdir "${CMAKE_HOME_DIRECTORY}/src")
761
762 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
763 set(includedir ${CMAKE_INSTALL_PREFIX}/include)
764 set(top_builddir ${CMAKE_HOME_DIRECTORY})
765 set(libdir ${exec_prefix}/lib)
766 set(CMAKE_LINKARGS "${CMAKE_CURRENT_BINARY_DIR}/lib")
767 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/lib:${gtnets_path}/lib:$LD_LIBRARY_PATH")
768
769 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/smpif.h.in ${CMAKE_HOME_DIRECTORY}/include/smpi/smpif.h @ONLY)
770 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc @ONLY)
771 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c @ONLY)
772 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff @ONLY)
773 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun @ONLY)
774 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/hostfile ${CMAKE_CURRENT_BINARY_DIR}/examples/smpi/hostfile COPYONLY)
775 configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY)
776 configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform_with_routers.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform_with_routers.xml COPYONLY)
777
778 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABLE OKITOKI)
779 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c" OUTPUT_VARIABLE OKITOKI)
780 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff" OUTPUT_VARIABLE OKITOKI)
781 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun" OUTPUT_VARIABLE OKITOKI)