The goal is to be able to give compiler flags at cmake time, and to have
them used later by the smpi script.
For example, it can be used to pass "-m64" and build a 64bit simgrid
when it's 32it by default (e.g. on Solaris).
The goal is, for example, to be able to set the variable
+## Save compiler flags preset with environment variables CFLAGS or CXXFLAGS;
+## they will used within smpicc, smpicxx.
+## Do it early so that we get their genuine values. The same will be done later for Fortran.
+set(SMPI_C_FLAGS "${CMAKE_C_FLAGS}")
+set(SMPI_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Check for the compiler #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Check for the compiler #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
## Request full debugging flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
## Request full debugging flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
-set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
if (CMAKE_COMPILER_IS_GNUCC)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
if (CMAKE_COMPILER_IS_GNUCC)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
set(SMPI_Fortran_LIBS "")
set(SMPI_FLANG 1)
endif()
set(SMPI_Fortran_LIBS "")
set(SMPI_FLANG 1)
endif()
+ set(SMPI_Fortran_FLAGS "${SMPI_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS}")
+
+ ## Request debugging flags for Fortran too
+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
set(SMPI_FORTRAN 1)
endif(CMAKE_Fortran_COMPILER)
set(SMPI_FORTRAN 1)
endif(CMAKE_Fortran_COMPILER)
LINKER_UNDEFINED_ERROR="1"
fi
LINKER_UNDEFINED_ERROR="1"
fi
+list_set CFLAGS @SMPI_C_FLAGS@
list_set LINKARGS "-lm"
if [ "x@WIN32@" = "x1" ]; then
list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
list_set LINKARGS "-lm"
if [ "x@WIN32@" = "x1" ]; then
list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
-list_set CXXFLAGS "-std=gnu++11"
+list_set CXXFLAGS "-std=gnu++11" @SMPI_CXX_FLAGS@
list_set LINKARGS
if [ "@WIN32@" != "1" ]; then
list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"
list_set LINKARGS
if [ "@WIN32@" != "1" ]; then
list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"