Commit 56d8705f authored by jclamber's avatar jclamber

add more C and Fortran checking options

git-svn-id: http://svn.oamp.fr/repos/unsio/trunk@129 ce2cc22f-6084-46ce-a062-084b172ee5dc
parent 1971966c
......@@ -56,7 +56,10 @@ SET(LIBRARY_OUTPUT_PATH ../lib)
add_definitions(${OPT} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${WARNCPP} )
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${WARNC} )
SET(CMAKE_Fortran_FLAGS ${CMAKE_Fortran_FLAGS} ${WARNF})
if (CMAKE_Fortran_COMPILER)
SET(CMAKE_Fortran_FLAGS ${CMAKE_Fortran_FLAGS} ${WARNF})
endif()
# remove -DNDEBUG in RElease mode to keep activated assert calls
STRING(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
......
......@@ -86,10 +86,19 @@ endif(OSX)
# ------------------
# TEST PROGRAM
# ------------------
if(DEFINED CMAKE_Fortran_COMPILER AND CMAKE_Fortran_COMPILER MATCHES "^$")
set(CMAKE_Fortran_COMPILER CMAKE_Fortran_COMPILER-NOTFOUND)
endif(DEFINED CMAKE_Fortran_COMPILER AND CMAKE_Fortran_COMPILER MATCHES "^$")
enable_language(Fortran OPTIONAL)
message(STATUS "CMAKE_Fortran_COMPILER_WORKS = ${CMAKE_Fortran_COMPILER_WORKS}")
# Enable Fortran support
ENABLE_LANGUAGE(Fortran)
#SET(CMAKE_Fortran_COMPILER ${FORT_COMP})
SET(CMAKE_Fortran_COMPILER gfortran)
#ENABLE_LANGUAGE(Fortran)
#if (${CMAKE_Fortran_COMPILER} STREQUAL CMAKE_Fortran_COMPILER-NOTFOUND)
# MESSAGE(STATUS "NO FORTRAN")
#else ()
# SET(CMAKE_Fortran_COMPILER gfortran)
#endif()
# Executbale output path
set(EXECUTABLE_OUTPUT_PATH bin)
......@@ -126,6 +135,7 @@ ENDFOREACH(exe_cpp ${execpp_sources})
# build Fortran executables according to the source
# compilation options
if (CMAKE_Fortran_COMPILER)
FOREACH(exe_f ${exe_sources})
get_filename_component(exe ${exe_f} NAME_WE)
......@@ -140,7 +150,7 @@ FOREACH(exe_f ${exe_sources})
# add "-lstdc++"
#SET(CMAKE_Fortran_LINK_FLAGS "-L${NEMOLIB} ") #-lstdc++")
ENDFOREACH(exe_f ${exe_sources})
endif()
# ----------------------------------------------------------
......
......@@ -35,7 +35,21 @@ endif ()
#typed_cache_set (STRING "compilation warnings" WARNCPP "-Waddress -Warray-bounds -Wc++0x-compat -Wchar-subscripts -Wenum-compare -Wcomment -Wformat -Wmain -Wmissing-braces -Wparentheses -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var")
typed_cache_set (STRING "compilation warnings" WARNCPP "-Wall")
typed_cache_set (STRING "compilation warnings" WARNC "-Warray-bounds -Wchar-subscripts -Wcomment -Wformat -Wmain -Wmissing-braces -Wsequence-point -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused-label -Wvolatile-register-var")
# check C compiler flags
include(CheckCCompilerFlag)
set (XX -Warray-bounds -Wchar-subscripts -Wcomment -Wformat -Wmain -Wmissing-braces -Wsequence-point -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused-label -Wvolatile-register-var)
set (WARNC_TMP "")
FOREACH(CWC ${XX})
MESSAGE(STATUS "Test C options==> " ${CWC})
check_c_compiler_flag(${CWC} HAS_OPTION)
if (HAS_OPTION)
set(WARNC_TMP "${WARNC_TMP} ${CWC}")
endif()
endforeach()
typed_cache_set (STRING "compilation warnings" WARNC ${WARNC_TMP})
message(STATUS "Warnc = " ${WARNC} )
typed_cache_set (STRING "compilation warnings" WARNF "-Wall" )
# just for testing
option(RELEASE "RELEASE " ON) # SHARED lib default
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment