diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ddb0607b..9c14c3921 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 89dbb8865..08f092ee0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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() diff --git a/examples/F90/CMakeLists.txt b/examples/F90/CMakeLists.txt index e6bf8a1d6..f4a23ff1c 100644 --- a/examples/F90/CMakeLists.txt +++ b/examples/F90/CMakeLists.txt @@ -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 ) diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index a571a4426..657c1de91 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -if( EC_HAVE_FORTRAN ) +if( HAVE_FORTRAN ) set( srcdir ${CMAKE_CURRENT_SOURCE_DIR} ) set( bindir ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9a737a5e7..35a6ee7b6 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -18,9 +18,9 @@ if( HAVE_PYTHON ) set(PYTHON_DEST "${INSTALL_LIB_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/eccodes" ) - file( RELATIVE_PATH relative_rpath "${CMAKE_INSTALL_PREFIX}/${PYTHON_DEST}" "${${PNAME}_FULL_INSTALL_LIB_DIR}" ) + file( RELATIVE_PATH relative_rpath "${CMAKE_INSTALL_PREFIX}/${PYTHON_DEST}" "${${PNAME}_FULL_INSTALL_LIB_DIR}" ) - # debug_var( relative_rpath ) + # debug_var( relative_rpath ) ecbuild_append_to_rpath( ${relative_rpath} ) ecbuild_append_to_rpath( "../../lib" ) # for ctest to find the libs diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index ce7f1965e..b4dab7601 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -13,5 +13,5 @@ set( ECCODES_SAMPLES_FILES ${ECCODES_SAMPLES_FILES} PARENT_SCOPE ) # copy the samples to the build directory -file( COPY ${samples_files} - DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/samples ) +file( COPY ${samples_files} + DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/samples )