CMake: fortran and examples features

This commit is contained in:
Shahram Najm 2015-06-09 14:50:51 +01:00
parent 4a53d7cfa2
commit 76bd03e33a
6 changed files with 26 additions and 15 deletions

View File

@ -12,7 +12,6 @@ project( eccodes C )
set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake")
#set( ECCODES_INSTALL_INCLUDE_DIR include CACHE PATH "ecCodes override installation directory for header files")
include( ecbuild_system )
@ -26,6 +25,11 @@ ecbuild_declare_project()
###############################################################################
# some variables/options of this project
ecbuild_add_option( FEATURE EXAMPLES
DESCRIPTION "Build the examples"
DEFAULT ON
)
ecbuild_add_option( FEATURE JPG
DESCRIPTION "support for JPG decoding/encoding"
DEFAULT ON
@ -59,17 +63,22 @@ ecbuild_add_option( FEATURE AEC
ecbuild_add_option( FEATURE PYTHON
DESCRIPTION "build the ecCodes Python interface"
DEFAULT ON
# REQUIRED_LANGUAGES Python # TODO
)
ecbuild_add_option( FEATURE FORTRAN
DESCRIPTION "build the ecCodes Fortran interface"
DEFAULT ON
# REQUIRED_LANGUAGES Fortran # TODO
)
# TODO Remove this after REQUIRED_LANGUAGES
if( ENABLE_FORTRAN )
# will set EC_HAVE_FORTRAN with the result
ecbuild_enable_fortran( MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/fortran/modules )
set( HAVE_FORTRAN ${EC_HAVE_FORTRAN} )
else()
set( HAVE_FORTRAN 0 )
endif()
# advanced options (not visible in cmake-gui )

View File

@ -1,4 +1,6 @@
add_subdirectory(C)
add_subdirectory(F90)
add_subdirectory(python)
if( HAVE_EXAMPLES )
add_subdirectory(C)
add_subdirectory(F90)
add_subdirectory(python)
endif()

View File

@ -50,7 +50,7 @@ list( APPEND tests
# SOURCES samples.f90
# LIBS eccodes_f90 eccodes
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/samples.sh
# CONDITION EC_HAVE_FORTRAN
# CONDITION HAVE_FORTRAN
# )
foreach( tool ${tests} )
@ -59,7 +59,7 @@ foreach( tool ${tests} )
ecbuild_add_executable( TARGET f_${tool}
NOINSTALL
SOURCES ${tool}.f90
CONDITION EC_HAVE_FORTRAN
CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes
)
@ -67,7 +67,7 @@ foreach( tool ${tests} )
ecbuild_add_test( TARGET f_${tool}_test
TYPE SCRIPT
DEPENDS f_${tool}
CONDITION EC_HAVE_FORTRAN
CONDITION HAVE_FORTRAN
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh
RESOURCES include.sh
TEST_DEPENDS get_gribs get_bufrs
@ -79,21 +79,21 @@ endforeach()
ecbuild_add_executable( TARGET f_new_from_file
NOINSTALL
SOURCES new_from_file.f90
CONDITION EC_HAVE_FORTRAN
CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes
)
ecbuild_add_executable( TARGET f_copy_namespace
NOINSTALL
SOURCES copy_namespace.f90
CONDITION EC_HAVE_FORTRAN
CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes
)
ecbuild_add_executable( TARGET f_set_gvc
NOINSTALL
SOURCES set_gvc.f90
CONDITION EC_HAVE_FORTRAN
CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes
)

View File

@ -1,4 +1,4 @@
if( EC_HAVE_FORTRAN )
if( HAVE_FORTRAN )
set( srcdir ${CMAKE_CURRENT_SOURCE_DIR} )
set( bindir ${CMAKE_CURRENT_BINARY_DIR} )